Hi,

I'm hacking up a system to manage attendees at a camp.

I have a Person model (which might be better as a customer UserModel, still 
not sure).

There are multiple types of people - e.g. camp attendees, staff, 
supervisors etc.

Each person that is a camp attendee will also have an "Attendance" model 
associated with it (but other types of people will not have one).

If you think I'm better off modelling it a different way (e.g. abstract 
models, or some kind of inheritance), I'm open to suggestions.

This is my models.py fragment for Attendance:

class Attendance(models.Model):
>     person = models.OneToOneField(Person)
>     stream = models.ForeignKey(Stream)
>     subjects = models.ManyToManyField(Subject)
>     camp = models.ForeignKey(Camp)


This is my admin.py for Person:

class AttendanceInline(admin.TabularInline):
>     model = Attendance 

 

class PersonAdmin(admin.ModelAdmin):
>     date_hierarchy = 'date_of_birth'
>     fieldsets = (
>         ('Personal Details', {
>             'fields': ('first_name', 'middle_name', 'last_name', 'gender', 
> 'date_of_birth', 'passport_number', 'working_with_children_check', 'photo', 
> 'school', 'home_church')
>         }),
>         ('Contact Details', {
>             'fields': ('email', 'phone_number', 'postal_address', 
> 'home_address')
>         }),
>         ('Other - think of a better name', {
>             'fields': ('serving_church', 'supervisor', 'year_12')
>         })
>     )
>     inlines = [
>         AttendanceInline,
>     ] 

 

admin.site.register(Person, PersonAdmin)


and my admin.py for Attendance:

class AttendanceAdmin(admin.ModelAdmin):
>     filter_horizontal = ['subjects']



When I edit a Person model, I want to have an inline for Attendance, and in 
that, use a filter_horizontal widget for "subjects".

However, currently, AttendanceAdmin on it's own has the filter_horizontal, 
but the inline does not.

This ticket seems to imply it should work:

https://code.djangoproject.com/ticket/8292

hence I'm assuming I've wired up something wrong in the above - any 
thoughts?

Cheers,
Victor

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/b11ccc5a-d021-46c0-9ca5-6f8b40154467%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to