Commit afdd97d5 by Bridger Maxwell

Made a workaround for django bug 15040, which made permissions forms have all checked boxes.

parent 6ccd08e0
...@@ -476,6 +476,7 @@ class Settings(ArticleMixin, TemplateView): ...@@ -476,6 +476,7 @@ class Settings(ArticleMixin, TemplateView):
# could be mixed up with a different instance # could be mixed up with a different instance
# Use strategy from Edit view... # Use strategy from Edit view...
setattr(settings_forms[i], 'action', 'form%d' % i) setattr(settings_forms[i], 'action', 'form%d' % i)
return settings_forms return settings_forms
def post(self, *args, **kwargs): def post(self, *args, **kwargs):
...@@ -498,8 +499,15 @@ class Settings(ArticleMixin, TemplateView): ...@@ -498,8 +499,15 @@ class Settings(ArticleMixin, TemplateView):
def get(self, *args, **kwargs): def get(self, *args, **kwargs):
self.forms = [] self.forms = []
# There is a bug where articles fetched with select_related have bad boolean field https://code.djangoproject.com/ticket/15040
# We fetch a fresh new article for this reason
new_article = models.Article.objects.get(id=self.article.id)
for Form in self.get_form_classes(): for Form in self.get_form_classes():
self.forms.append(Form(self.article, self.request)) self.forms.append(Form(new_article, self.request))
print self.forms[1].instance
return super(Settings, self).get(*args, **kwargs) return super(Settings, self).get(*args, **kwargs)
def get_success_url(self): def get_success_url(self):
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment