I've upgraded to Django 1.7.1
-- Following the upgrade most (haven't tested all, but for all tested this true) the over-rided queryset is not functioning.
when the code calls
qs=Member.Active_objects.all()
then all members are returned, not just those which confrom to the filter specified in the Class MemberActive(models.Manager)
this all worked for many years and only now works following upgrade to 1.7.1. I upgraded just to keep up. Now regret that decision, but difficult to go back.
I've tried both get_query_set() and get_queryset() ... I understand the latter is required in 1.7.
Any suggestions?
===the code snippets:
class MemberActive(models.Manager):
def get_guery_set(self):
qs=super(MemberActive, self).get_query_set().filter(status='Active')
return qs
class Member(models.Model):
membertype=models.ForeignKey(Membertype,related_name='members',db_column='mtypeid', null=True, on_delete=models.SET_NULL,help_text='Type of member.',verbose_name='Member Type')
lname = models.CharField(max_length=150, db_column='lame', blank=True, help_text='Last name.',verbose_name='Last Name')
fname = models.CharField(max_length=150, db_column='fame', blank=True, help_text='First name.',verbose_name='First Name')
status = models.CharField(max_length=12,db_column="status", blank=True,help_text="Membership status)
objects = models.Manager() # the default manager
Active_objects = MemberActive()
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+unsubscribe@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/b50fb9fd-8c2c-41db-93a6-f4329e7498b3%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
No comments:
Post a Comment