adding a GroupUser inline, marking optional fields
This commit is contained in:
Родитель
b9e21846d3
Коммит
b797ddbace
|
@ -1,17 +1,17 @@
|
|||
from django.contrib import admin
|
||||
|
||||
from .models import Group
|
||||
from .models import Group, GroupUser
|
||||
|
||||
|
||||
# XXX: needs Django 1.2
|
||||
# class UserInline(admin.TabularInline):
|
||||
# Group.users.through
|
||||
# raw_id_fields = ('user_id',)
|
||||
class GroupUserInline(admin.TabularInline):
|
||||
model = GroupUser
|
||||
raw_id_fields = ('user',)
|
||||
|
||||
|
||||
class GroupAdmin(admin.ModelAdmin):
|
||||
raw_id_fields = ('users',)
|
||||
ordering = ('name',)
|
||||
list_display = ('name', 'rules')
|
||||
inlines = (GroupUserInline,)
|
||||
|
||||
admin.site.register(Group, GroupAdmin)
|
||||
|
|
|
@ -1,11 +1,13 @@
|
|||
from django.contrib import admin
|
||||
|
||||
from access.admin import GroupUserInline
|
||||
from .models import UserProfile
|
||||
|
||||
|
||||
class UserAdmin(admin.ModelAdmin):
|
||||
list_display = ('__unicode__', 'email')
|
||||
search_fields = ('^email',)
|
||||
inlines = (GroupUserInline,)
|
||||
|
||||
|
||||
admin.site.register(UserProfile, UserAdmin)
|
||||
|
|
|
@ -34,7 +34,8 @@ class UserProfile(amo.models.ModelBase):
|
|||
|
||||
averagerating = models.CharField(max_length=255, blank=True)
|
||||
bio = TranslatedField()
|
||||
confirmationcode = models.CharField(max_length=255, default='')
|
||||
confirmationcode = models.CharField(max_length=255, default='',
|
||||
blank=True)
|
||||
deleted = models.BooleanField(default=True)
|
||||
display_collections = models.BooleanField(default=False)
|
||||
display_collections_fav = models.BooleanField(default=False)
|
||||
|
@ -44,13 +45,14 @@ class UserProfile(amo.models.ModelBase):
|
|||
notes = models.TextField(blank=True)
|
||||
notifycompat = models.BooleanField(default=True)
|
||||
notifyevents = models.BooleanField(default=True)
|
||||
occupation = models.CharField(max_length=765, default='')
|
||||
picture_type = models.CharField(max_length=75, default='')
|
||||
resetcode = models.CharField(max_length=255, default='')
|
||||
resetcode_expires = models.DateTimeField(default=datetime.now)
|
||||
occupation = models.CharField(max_length=765, default='', blank=True)
|
||||
picture_type = models.CharField(max_length=75, default='', blank=True)
|
||||
resetcode = models.CharField(max_length=255, default='', blank=True)
|
||||
resetcode_expires = models.DateTimeField(default=datetime.now,
|
||||
blank=True)
|
||||
sandboxshown = models.BooleanField(default=False)
|
||||
|
||||
user = models.ForeignKey(DjangoUser, null=True)
|
||||
user = models.ForeignKey(DjangoUser, null=True, editable=False, blank=True)
|
||||
|
||||
class Meta:
|
||||
db_table = 'users'
|
||||
|
|
Загрузка…
Ссылка в новой задаче