after upgrade to django 1.11 from 1.10.6 getting an exception on runserver

43 views
Skip to first unread message

Mukul Acharya

unread,
Apr 5, 2017, 11:25:25 AM4/5/17
to Django users
Traceback (most recent call last):
    fn(*args, **kwargs)
    autoreload.raise_last_exception()
    six.reraise(*_exception)
    fn(*args, **kwargs)
    apps.populate(settings.INSTALLED_APPS)
    app_config.ready()
    self.module.autodiscover()
    autodiscover_modules('admin', register_to=site)
    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, PopularBrandAdminForm
  File "/srv/webapps/myproj.com/myproj/product/forms.py", line 124, in <module>
    class CatAdminForm(forms.ModelForm):
    opts.field_classes)
    formfield.queryset = formfield.queryset.complex_filter(limit_choices_to)
    clone.query.add_q(filter_obj)
    clause, _ = self._add_q(q_object, self.used_aliases)
    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 = criteria

    def add_to_query(self, query, aliases):
        query.add_q(models.Q(id__in=[1, 2, 3]))
        query.distinct = True


class 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'))

Tim Graham

unread,
Apr 5, 2017, 12:23:14 PM4/5/17
to Django users
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.
Reply all
Reply to author
Forward
0 new messages