Added chapters to charter members

This commit is contained in:
Zakary Timson 2018-01-14 17:24:58 -05:00
parent c70e07e5fc
commit 22afbca227
2 changed files with 14 additions and 5 deletions

View File

@ -1,15 +1,16 @@
from django.contrib import admin
from .models import Position, Attorney
from .models import Chapter, Position, Attorney
admin.site.register(Chapter)
admin.site.register(Position)
@admin.register(Attorney)
class MemberAdmin(admin.ModelAdmin):
list_display = ('name', 'position', 'phone_formatted', 'email', 'front_page', 'joined', 'thumbnail')
list_filter = ['position', 'front_page', 'joined']
search_fields = ('email', 'joined', 'name', 'position', 'website', 'phone', 'phone_formatted')
fields = ('image_preview', 'image', 'name', 'position', 'biography', 'phone', 'email', 'website', 'front_page', 'joined')
list_display = ('name', 'position', 'chapter', 'phone_formatted', 'email', 'front_page', 'joined', 'thumbnail')
list_filter = ['chapter', 'position', 'front_page', 'joined']
search_fields = ('email', 'joined', 'name', 'chapter', 'position', 'website', 'phone', 'phone_formatted')
fields = ('image_preview', 'image', 'name', 'position', 'chapter', 'biography', 'phone', 'email', 'website', 'front_page', 'joined')
readonly_fields = ('image_preview',)

View File

@ -4,6 +4,13 @@ from django.db import models
from tinymce import HTMLField
class Chapter(models.Model):
name = models.CharField(max_length=50)
def __str__(self):
return self.name
class Position(models.Model):
position_name = models.CharField(max_length=50)
@ -13,6 +20,7 @@ class Position(models.Model):
class Attorney(models.Model):
biography = HTMLField(blank=True, null=True)
chapter = models.ForeignKey(Chapter, blank=True, null=True)
email = models.CharField(max_length=255, blank=True, null=True)
front_page = models.BooleanField(default=False)
image = models.ImageField(upload_to='portraits', default='portraits/silhouette.png')