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