On Sat, 2019-06-08 at 18:36 +0100, Stephen Finucane wrote:
> As was designed, starting the interpreter would cause the State model
> and its entries to be evaluated. This was an issue if, for example, the
> model had been modified and you were attempting to apply the migration.
> 
>   Traceback (most recent call last):
>     File "manage.py", line 11, in <module>
>       execute_from_command_line(sys.argv)
>     ...
>     File "/usr/local/lib/python2.7/dist-packages/django/forms/models.py", 
> line 1199, in _set_queryset
>       self.widget.choices = self.choices
>     File "/home/patchwork/patchwork/patchwork/forms.py", line 157, in 
> _get_choices
>       super(OptionalModelChoiceField, self)._get_choices())
>     File "/usr/local/lib/python2.7/dist-packages/django/forms/models.py", 
> line 1143, in __len__
>       return (len(self.queryset) + (1 if self.field.empty_label is not None 
> else 0))
>     File "/usr/local/lib/python2.7/dist-packages/django/db/models/query.py", 
> line 232, in __len__
>       self._fetch_all()
>     File "/usr/local/lib/python2.7/dist-packages/django/db/models/query.py", 
> line 1118, in _fetch_all
>       self._result_cache = list(self._iterable_class(self))
>     File "/usr/local/lib/python2.7/dist-packages/django/db/models/query.py", 
> line 53, in __iter__
>       results = compiler.execute_sql(chunked_fetch=self.chunked_fetch)
>     File 
> "/usr/local/lib/python2.7/dist-packages/django/db/models/sql/compiler.py", 
> line 899, in execute_sql
>       raise original_exception
>   django.db.utils.OperationalError: (1054, "Unknown column 
> 'patchwork_state.slug' in 'field list'")
> 
> Resolve this by moving the evaluation into '__init__', meaning it will
> only occur when a new form is created.
> 
> Signed-off-by: Stephen Finucane <step...@that.guru>

Applied.

_______________________________________________
Patchwork mailing list
Patchwork@lists.ozlabs.org
https://lists.ozlabs.org/listinfo/patchwork

Reply via email to