Commit 1ea7f10b authored by Jean-Baptiste's avatar Jean-Baptiste

update: move back jabber config

parent 11dc77f0
Pipeline #1911 passed with stage
in 27 seconds
from django.contrib import admin
from .models import Account, ChatProfile, ChatConfig
from .models import Account, ChatProfile
class ChatProfileInline(admin.StackedInline):
model = ChatProfile
class ChatConfigAdmin(admin.ModelAdmin):
inlines = [ChatProfileInline]
admin.site.register(ChatConfig, ChatConfigAdmin)
admin.site.register(ChatProfile)
admin.site.register(Account)
# -*- coding: utf-8 -*-
# Generated by Django 1.11 on 2019-01-21 16:51
from __future__ import unicode_literals
from django.db import migrations, models
def migrate_data(apps, schema_editor):
ChatProfile = apps.get_model('djangoldp_account', 'ChatProfile')
for profile in ChatProfile.objects.all():
profile.jabberID = profile.config.jabberID
class Migration(migrations.Migration):
dependencies = [
('djangoldp_account', '0001_initial'),
]
operations = [
migrations.AddField(
model_name='chatprofile',
name='jabberID',
field=models.CharField(blank=True, max_length=255, null=True),
),
migrations.AddField(
model_name='chatprofile',
name='jabberRoom',
field=models.BooleanField(default=True),
),
migrations.RunPython(migrate_data),
]
# -*- coding: utf-8 -*-
# Generated by Django 1.11 on 2019-01-21 16:59
from __future__ import unicode_literals
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('djangoldp_account', '0002_auto_20190121_1651'),
]
operations = [
migrations.RemoveField(
model_name='chatprofile',
name='config',
),
migrations.RemoveField(
model_name='chatprofile',
name='jabberRoom',
),
]
# -*- coding: utf-8 -*-
# Generated by Django 1.11 on 2019-01-21 17:06
from __future__ import unicode_literals
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('djangoldp_circle', '0004_remove_circle_chatconfig'),
('djangoldp_project', '0004_remove_project_chatconfig'),
('djangoldp_account', '0003_auto_20190121_1659'),
]
operations = [
migrations.DeleteModel(
name='ChatConfig',
),
]
......@@ -17,23 +17,9 @@ class Account(models.Model):
return '{} ({})'.format(self.user.get_full_name(), self.user.username)
class ChatConfig(models.Model):
jabberID = models.CharField(max_length=255, blank=True, null=True)
jabberRoom = models.BooleanField(default=True)
class Meta:
permissions = (
('view_chatroom', 'Read'),
('control_chatroom', 'Control'),
)
def __str__(self):
return '{} ({})'.format(self.jabberID, self.jabberRoom)
class ChatProfile(models.Model):
user = models.OneToOneField(User, on_delete=models.CASCADE, related_name="chatProfile")
config = models.OneToOneField(ChatConfig)
jabberID = models.CharField(max_length=255, blank=True, null=True)
class Meta:
permissions = (
......
......@@ -6,7 +6,7 @@ from django.conf.urls import url, include
from django.contrib.auth.models import Group
from djangoldp.views import LDPViewSet
from .models import ChatProfile, Account, ChatConfig
from .models import ChatProfile, Account
from .views import userinfocustom
djangoldp_modules = list(filter(lambda app: app.startswith('djangoldp_'), settings.INSTALLED_APPS))
......@@ -27,7 +27,6 @@ urlpatterns = [
url(r'^accounts/', include('django.contrib.auth.urls')),
url(r'^accounts/', LDPViewSet.urls(model=Account)),
url(r'^chat-profile/', LDPViewSet.urls(model=ChatProfile)),
url(r'^chat-config/', LDPViewSet.urls(model=ChatConfig)),
url(r'^openid/userinfo', userinfocustom),
url(r'^openid/', include('oidc_provider.urls', namespace='oidc_provider')),
]
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment