Hi,

Here is "Member"

MEMBER_TYPE_CHOICES = (
                       ('staff','Staff'),
                       ('board','Board'),
)

class Member(models.Model):
    member_type = models.CharField(max_length=30,
choices=MEMBER_TYPE_CHOICES)
    first_name = models.CharField(max_length=30)
    middle_name = models.CharField(max_length=30, blank=True)
    last_name = models.CharField(max_length=30)
    email = models.EmailField(blank=True)
    bio = models.TextField(blank=True)

    def __unicode__(self):
        return u'%s, %s' % (self.last_name, self.first_name)

class MemberAdmin(admin.ModelAdmin):
    ordering = ['last_name']
    list_display = ('full_name','email',)
    list_filter = ('member_type',)
    fieldsets = (
                ('Fields marked in bold are required.', {
                                                         'fields' :
('member_type', ('first_name', 'middle_name', 'last_name'),'email',
'bio')
                                                         }
                ),
    )


and Job:

from my_project.members.models import Member

COMPENSATION_TYPE_CHOICES = (
                             ('salary','Salary'),
                             ('hourly','Hourly'),
)

class Job(models.Model):
    title = models.CharField(max_length=255)
    compensation = models.CharField(max_length=30,
choices=COMPENSATION_TYPE_CHOICES)
    positions_availabble = models.PositiveSmallIntegerField()
    short_description = models.CharField(max_length=255,
help_text='Please give a short description of the job opportunity for
display in the list view.')
    long_description = models.TextField()
    requirements = models.TextField()
    staff_members_to_notify = models.ManyToManyField(Member,
limit_choices_to = {'member_type' : 'staff'})

    def __unicode__(self):
        return self.title

class JobAdmin(admin.ModelAdmin):
    pass

admin.site.register(Job, JobAdmin)

I'm using the newforms-admin branch of Django. Thanks,
Brandon

On May 30, 1:56 pm, Rajesh Dhawan <[EMAIL PROTECTED]> wrote:
> Hi again, Brandon,
>
> > Thanks for pointing that out in the documentation, I wasn't aware of
> > that filter. However, I can't seem to get it to work.
>
> > I've tried specifying the values as:
>
> > staff_members_to_notify = models.ManyToManyField(Member,
> > limit_choices_to = {'member_type' : 'staff'})
>
> > and several other variations, and I can't get it to fail or succeed in
> > filtering the resulting list of Member objects. Thoughts?
>
> Can you paste the model that contains this staff_members_to_notify
> field as well as the model for Member?
>
> -Rajesh
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to