Minor fixes
This commit is contained in:
1 parent
6ea07b462e
commit
6090f6a1f0
4 files changed
+9
-2
No files matched your search
@@ -9,7 +9,8 @@ def normalize_prefixes(apps, schema_editor):
|
||||
OrgUnit = apps.get_model("mailadmin", "OrgUnit")
|
||||
|
||||
for ou in OrgUnit.objects.all():
|
||||
Prefix.objects.create(name=ou.prefix, orgunit=ou)
|
||||
if ou.prefix:
|
||||
Prefix.objects.create(name=ou.prefix, orgunit=ou)
|
||||
|
||||
|
||||
def noop(*args, **kwargs):
|
||||
|
||||
+5
-1
@@ -1,3 +1,4 @@
|
||||
from __future__ import unicode_literals
|
||||
from django.contrib.auth.models import Group
|
||||
from django.db import models
|
||||
|
||||
@@ -27,9 +28,12 @@ class PrefixQueryset(models.QuerySet):
|
||||
|
||||
class Prefix(models.Model):
|
||||
def __unicode__(self):
|
||||
return self.name
|
||||
return self.name or ''
|
||||
|
||||
name = models.CharField(max_length=500, blank=True, null=True)
|
||||
orgunit = models.ForeignKey('mailadmin.OrgUnit', related_name='prefixes')
|
||||
|
||||
objects = PrefixQueryset.as_manager()
|
||||
|
||||
class Meta:
|
||||
verbose_name_plural = 'prefixes'
|
||||
@@ -1,3 +1,4 @@
|
||||
from __future__ import unicode_literals
|
||||
from django.conf import settings
|
||||
from django.contrib.auth.models import User, Group
|
||||
from rest_framework import serializers
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
from __future__ import unicode_literals
|
||||
from django.conf import settings
|
||||
from django.contrib.auth import login, logout as auth_logout
|
||||
from django.contrib.auth.decorators import login_required
|
||||
|
||||
Reference in new issue
Block a user