Add fields to admin interface
This commit is contained in:
parent
1ff59d5d7d
commit
a304da76be
3 changed files with 7 additions and 6 deletions
|
@ -48,12 +48,12 @@ admin.site.register(City, CityAdmin)
|
||||||
|
|
||||||
class ProfileAdmin(admin.ModelAdmin):
|
class ProfileAdmin(admin.ModelAdmin):
|
||||||
raw_id_fields = ('city',)
|
raw_id_fields = ('city',)
|
||||||
list_display = ('user', 'realname', 'city', 'web_url', 'send_notifications')
|
list_display = ('user', 'realname', 'city', 'web_url', 'send_notifications', 'do_not_track')
|
||||||
list_filter = ('send_notifications', 'user__last_login')
|
list_filter = ('send_notifications', 'do_not_track', 'user__last_login')
|
||||||
admin.site.register(UserProfile, ProfileAdmin)
|
admin.site.register(UserProfile, ProfileAdmin)
|
||||||
|
|
||||||
class OrgAdmin(admin.ModelAdmin):
|
class OrgAdmin(admin.ModelAdmin):
|
||||||
list_display = ('name', 'site')
|
list_display = ('name', 'slug', 'site')
|
||||||
admin.site.register(Organization, OrgAdmin)
|
admin.site.register(Organization, OrgAdmin)
|
||||||
|
|
||||||
class SponsorAdmin(admin.ModelAdmin):
|
class SponsorAdmin(admin.ModelAdmin):
|
||||||
|
@ -86,6 +86,7 @@ admin.site.register(Place, PlaceAdmin)
|
||||||
class EventAdmin(admin.ModelAdmin):
|
class EventAdmin(admin.ModelAdmin):
|
||||||
raw_id_fields = ('place', 'created_by', 'sponsors')
|
raw_id_fields = ('place', 'created_by', 'sponsors')
|
||||||
list_display = ('__str__', 'attendee_count', 'start_time', 'created_by', 'created_time')
|
list_display = ('__str__', 'attendee_count', 'start_time', 'created_by', 'created_time')
|
||||||
|
list_filter = ('created_time', ('created_by',admin.RelatedOnlyFieldListFilter), ('team',admin.RelatedOnlyFieldListFilter))
|
||||||
ordering = ('-start_time',)
|
ordering = ('-start_time',)
|
||||||
def attendee_count(self, event):
|
def attendee_count(self, event):
|
||||||
return event.attendees.all().count()
|
return event.attendees.all().count()
|
||||||
|
|
|
@ -91,7 +91,7 @@ class Event(models.Model):
|
||||||
|
|
||||||
attendees = models.ManyToManyField(UserProfile, through='Attendee', related_name="attending", blank=True)
|
attendees = models.ManyToManyField(UserProfile, through='Attendee', related_name="attending", blank=True)
|
||||||
|
|
||||||
sponsors = models.ManyToManyField('Sponsor', related_name='events')
|
sponsors = models.ManyToManyField('Sponsor', related_name='events', blank=True)
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def is_over(self):
|
def is_over(self):
|
||||||
|
|
|
@ -310,10 +310,10 @@ class Team(models.Model):
|
||||||
category = models.ForeignKey('Category', on_delete=models.SET_NULL, blank=False, null=True)
|
category = models.ForeignKey('Category', on_delete=models.SET_NULL, blank=False, null=True)
|
||||||
topics = models.ManyToManyField('Topic', blank=True)
|
topics = models.ManyToManyField('Topic', blank=True)
|
||||||
|
|
||||||
sponsors = models.ManyToManyField('Sponsor', related_name='teams')
|
sponsors = models.ManyToManyField('Sponsor', related_name='teams', blank=True)
|
||||||
|
|
||||||
is_premium = models.BooleanField(default=settings.EVENTS_TEAMS_DEFAULT_PREMIUM)
|
is_premium = models.BooleanField(default=settings.EVENTS_TEAMS_DEFAULT_PREMIUM)
|
||||||
premium_by = models.ForeignKey(UserProfile, related_name='premium_teams', null=True, on_delete=models.SET_NULL)
|
premium_by = models.ForeignKey(UserProfile, related_name='premium_teams', null=True, blank=True, on_delete=models.SET_NULL)
|
||||||
premium_started = models.DateTimeField(blank=True, null=True)
|
premium_started = models.DateTimeField(blank=True, null=True)
|
||||||
premium_expires = models.DateTimeField(blank=True, null=True)
|
premium_expires = models.DateTimeField(blank=True, null=True)
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue