[PATCH v2] REST: Don't iterate through models at class level

Denis Laxalde denis at laxalde.org
Tue Feb 7 23:47:34 AEDT 2017

Stephen Finucane a écrit :
> his causes two issues. Firstly, on fresh installs you see the following
> error message:
>   "Table 'patchwork.patchwork_state' doesn't exist"
> Secondly, any new states created when the process is running will not be
> reflected in the API until the server process is restarted.

I can confirm that this version fixes both issues now. Thanks!

> Resolve this issue by moving the step into a method, thus ensuring it's
> continuously refreshed. It doesn't seem possible to add tests to prevent
> this regressing but some similarly useful tests are included to at least
> validate the behavior of that field.

> ---
> v2:
> - Use a subclass of RelatedField instead to ensure lazy-loading of the
>   queryset
> - Improve tests by checking error messages and removing unnecessary
>   checks

Maybe the commit message should be updated to include these points?

More information about the Patchwork mailing list