Add fields to admin interface

This commit is contained in:
Michael Hall 2018-08-05 13:06:22 -04:00
parent 1ff59d5d7d
commit a304da76be
3 changed files with 7 additions and 6 deletions

View file

@ -48,12 +48,12 @@ admin.site.register(City, CityAdmin)
class ProfileAdmin(admin.ModelAdmin):
raw_id_fields = ('city',)
list_display = ('user', 'realname', 'city', 'web_url', 'send_notifications')
list_filter = ('send_notifications', 'user__last_login')
list_display = ('user', 'realname', 'city', 'web_url', 'send_notifications', 'do_not_track')
list_filter = ('send_notifications', 'do_not_track', 'user__last_login')
admin.site.register(UserProfile, ProfileAdmin)
class OrgAdmin(admin.ModelAdmin):
list_display = ('name', 'site')
list_display = ('name', 'slug', 'site')
admin.site.register(Organization, OrgAdmin)
class SponsorAdmin(admin.ModelAdmin):
@ -86,6 +86,7 @@ admin.site.register(Place, PlaceAdmin)
class EventAdmin(admin.ModelAdmin):
raw_id_fields = ('place', 'created_by', 'sponsors')
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',)
def attendee_count(self, event):
return event.attendees.all().count()

View file

@ -91,7 +91,7 @@ class Event(models.Model):
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
def is_over(self):

View file

@ -310,10 +310,10 @@ class Team(models.Model):
category = models.ForeignKey('Category', on_delete=models.SET_NULL, blank=False, null=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)
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_expires = models.DateTimeField(blank=True, null=True)