query.add_q() is a private API. I'd suggest to use git bisect to find the Django commit where the behavior changed. That might give you a hint of how to adapt your code.
On Wednesday, April 5, 2017 at 11:25:25 AM UTC-4, Mukul Acharya wrote:
-- On Wednesday, April 5, 2017 at 11:25:25 AM UTC-4, Mukul Acharya wrote:
Traceback (most recent call last):File "/srv/webapps/myproj.com/virtualenvs/myproj1.11/local/ ", line 227, in wrapperlib/python2.7/site-packages/ django/utils/autoreload.py fn(*args, **kwargs)File "/srv/webapps/myproj.com/virtualenvs/myproj1.11/local/ ", line 117, in inner_runlib/python2.7/site-packages/ django/core/management/ commands/runserver.py autoreload.raise_last_exception() File "/srv/webapps/myproj.com/virtualenvs/myproj1.11/local/ ", line 250, in raise_last_exceptionlib/python2.7/site-packages/ django/utils/autoreload.py six.reraise(*_exception)File "/srv/webapps/myproj.com/virtualenvs/myproj1.11/local/ ", line 227, in wrapperlib/python2.7/site-packages/ django/utils/autoreload.py fn(*args, **kwargs)File "/srv/webapps/myproj.com/virtualenvs/myproj1.11/local/ ", line 27, in setuplib/python2.7/site-packages/ django/__init__.py apps.populate(settings.INSTALLED_APPS) File "/srv/webapps/myproj.com/virtualenvs/myproj1.11/local/ ", line 116, in populatelib/python2.7/site-packages/ django/apps/registry.py app_config.ready()File "/srv/webapps/myproj.com/virtualenvs/myproj1.11/local/ ", line 23, in readylib/python2.7/site-packages/ django/contrib/admin/apps.py self.module.autodiscover()File "/srv/webapps/myproj.com/virtualenvs/myproj1.11/local/ ", line 26, in autodiscoverlib/python2.7/site-packages/ django/contrib/admin/__init__. py autodiscover_modules('admin', register_to=site)File "/srv/webapps/myproj.com/virtualenvs/myproj1.11/local/ lib/python2.7/site-packages/ django/utils/module_loading.py ", line 50, in autodiscover_modules import_module('%s.%s' % (app_config.name, module_to_search))File "/usr/lib/python2.7/importlib/__init__.py", line 38, in import_module __import__(name)File "/srv/webapps/myproj.com/myproj/product/admin.py ", line 6, in <module>from product.forms import ProductChangeLogFilterForm, PopularBrandAdminFormFile "/srv/webapps/myproj.com/myproj/product/forms.py ", line 124, in <module>class CatAdminForm(forms.ModelForm):File "/srv/webapps/myproj.com/virtualenvs/myproj1.11/local/ ", line 252, in __new__lib/python2.7/site-packages/ django/forms/models.py opts.field_classes)File "/srv/webapps/myproj.com/virtualenvs/myproj1.11/local/ ", line 177, in fields_for_modellib/python2.7/site-packages/ django/forms/models.py formfield.queryset = formfield.queryset.complex_filter(limit_choices_to) File "/srv/webapps/myproj.com/virtualenvs/myproj1.11/local/ ", line 814, in complex_filterlib/python2.7/site-packages/ django/db/models/query.py clone.query.add_q(filter_obj)File "/srv/webapps/myproj.com/virtualenvs/myproj1.11/local/ "lib/python2.7/site-packages/ django/db/models/sql/query.py , line 1260, in add_q clause, _ = self._add_q(q_object, self.used_aliases)File "/srv/webapps/myproj.com/virtualenvs/myproj1.11/local/ "lib/python2.7/site-packages/ django/db/models/sql/query.py , line 1275, in _add_q joinpromoter = JoinPromoter(q_object.connector, len(q_object.children), current_negated) AttributeError: LimitTagAssociations instance has no attribute 'children'class LimitTagAssociations():def __init__(self, criteria):self.criteria = criteriadef add_to_query(self, query, aliases):query.add_q(models.Q(id__in=[1, 2, 3])) query.distinct = Trueclass Cat(models.Model):new_and_now_reco_base = fields.IntegerRangeField(min_value=500, max_value=10000, default=1000) auto_taggroups = models.ManyToManyField(TagGroup, null=True, blank=True, limit_choices_to= LimitTagAssociations('1')) manual_taggroups = models.ManyToManyField(TagGroup, null=True, blank=True, limit_choices_to= LimitTagAssociations('2')) abs_url = models.CharField(max_length=255, blank=True, null=True) primary_filter_select = models.ManyToManyField(TagGroup, null=True, blank=True, limit_choices_to= LimitTagAssociations('3'))
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 https://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/68cc9293-cc83-4fbd-a20f-9c1b2f8b99b9%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
No comments:
Post a Comment