Refactoring
* splits ema/models.py into subpackage * splits konova/models.py into subpackage * splits user/models.py into subpackage
This commit is contained in:
10
user/models/__init__.py
Normal file
10
user/models/__init__.py
Normal file
@@ -0,0 +1,10 @@
|
||||
"""
|
||||
Author: Michel Peltriaux
|
||||
Organization: Struktur- und Genehmigungsdirektion Nord, Rhineland-Palatinate, Germany
|
||||
Contact: michel.peltriaux@sgdnord.rlp.de
|
||||
Created on: 15.11.21
|
||||
|
||||
"""
|
||||
from .user_action import *
|
||||
from .konova_user import *
|
||||
from .notification import *
|
||||
19
user/models/konova_user.py
Normal file
19
user/models/konova_user.py
Normal file
@@ -0,0 +1,19 @@
|
||||
"""
|
||||
Author: Michel Peltriaux
|
||||
Organization: Struktur- und Genehmigungsdirektion Nord, Rhineland-Palatinate, Germany
|
||||
Contact: michel.peltriaux@sgdnord.rlp.de
|
||||
Created on: 15.11.21
|
||||
|
||||
"""
|
||||
from django.contrib.auth.models import User
|
||||
from django.db import models
|
||||
|
||||
|
||||
class KonovaUserExtension(models.Model):
|
||||
""" Extension model for additional ksp features
|
||||
|
||||
Extends the default user model for some extras
|
||||
|
||||
"""
|
||||
user = models.OneToOneField(User, on_delete=models.CASCADE)
|
||||
notifications = models.ManyToManyField("user.UserNotification", related_name="+")
|
||||
34
user/models/notification.py
Normal file
34
user/models/notification.py
Normal file
@@ -0,0 +1,34 @@
|
||||
"""
|
||||
Author: Michel Peltriaux
|
||||
Organization: Struktur- und Genehmigungsdirektion Nord, Rhineland-Palatinate, Germany
|
||||
Contact: michel.peltriaux@sgdnord.rlp.de
|
||||
Created on: 15.11.21
|
||||
|
||||
"""
|
||||
from django.db import models
|
||||
|
||||
from user.enums import UserNotificationEnum
|
||||
|
||||
|
||||
class UserNotification(models.Model):
|
||||
""" Notifications for users
|
||||
|
||||
"""
|
||||
id = models.CharField(
|
||||
max_length=500,
|
||||
null=False,
|
||||
blank=False,
|
||||
choices=UserNotificationEnum.as_choices(drop_empty_choice=True),
|
||||
primary_key=True,
|
||||
)
|
||||
name = models.CharField(
|
||||
max_length=500,
|
||||
null=False,
|
||||
blank=False,
|
||||
unique=True,
|
||||
help_text="Human readable name"
|
||||
)
|
||||
is_active = models.BooleanField(default=True, help_text="Can be toggle to enable/disable this notification for all users")
|
||||
|
||||
def __str__(self):
|
||||
return self.name
|
||||
@@ -1,44 +1,15 @@
|
||||
"""
|
||||
Author: Michel Peltriaux
|
||||
Organization: Struktur- und Genehmigungsdirektion Nord, Rhineland-Palatinate, Germany
|
||||
Contact: michel.peltriaux@sgdnord.rlp.de
|
||||
Created on: 15.11.21
|
||||
|
||||
"""
|
||||
import uuid
|
||||
|
||||
from django.utils.translation import gettext_lazy as _
|
||||
from django.contrib.auth.models import User
|
||||
from django.db import models
|
||||
|
||||
from user.enums import UserNotificationEnum
|
||||
|
||||
|
||||
class UserNotification(models.Model):
|
||||
""" Notifications for users
|
||||
|
||||
"""
|
||||
id = models.CharField(
|
||||
max_length=500,
|
||||
null=False,
|
||||
blank=False,
|
||||
choices=UserNotificationEnum.as_choices(drop_empty_choice=True),
|
||||
primary_key=True,
|
||||
)
|
||||
name = models.CharField(
|
||||
max_length=500,
|
||||
null=False,
|
||||
blank=False,
|
||||
unique=True,
|
||||
help_text="Human readable name"
|
||||
)
|
||||
is_active = models.BooleanField(default=True, help_text="Can be toggle to enable/disable this notification for all users")
|
||||
|
||||
def __str__(self):
|
||||
return self.name
|
||||
|
||||
|
||||
class KonovaUserExtension(models.Model):
|
||||
""" Extension model for additional ksp features
|
||||
|
||||
Extends the default user model for some extras
|
||||
|
||||
"""
|
||||
user = models.OneToOneField(User, on_delete=models.CASCADE)
|
||||
notifications = models.ManyToManyField(UserNotification, related_name="+")
|
||||
from django.utils.translation import gettext_lazy as _
|
||||
|
||||
|
||||
class UserAction(models.TextChoices):
|
||||
Reference in New Issue
Block a user