Thursday, September 1, 2016

Re: Disadvantages of using model name rather than model class for FK field?

Yeah you're right about the development tools and being quicker for refactoring and alike. I believe typos will be caught when running `makemigrations` at least as it will complain about not being about to find the model.


On Thursday, 1 September 2016 13:39:31 UTC+1, Javier Guerra wrote:
On 1 September 2016 at 11:55, James Beith <ja...@beith.co.uk> wrote:
> By using a model name there are fewer imports at the top of the module and
> fewer occurrences of circular import dependencies between Django
> applications. What are the disadvantages to using a model name and why not
> always use them?


totally a wrong reason, but i like using classes instead of names
because that way it feels more "programming" and less "configuration".

a _possible_ (but not really convincing) reason would be that it makes
it easier for tools (syntax highlight, autocompleting editors, static
analyzers...) to detect typos.

--
Javier

--
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/38192e63-e4ab-45d7-99a0-c71fe4af5bf7%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment