Get decorator

63 views
Skip to first unread message

Hélio Correia

unread,
May 16, 2018, 6:36:49 PM5/16/18
to Django developers (Contributions to Django itself)
Hi community,

I always want to ask if it's not a god idea change some get_ methods with the property decorator? Things like get_absolute_url for example. What are your thoughts about that?

Matthew Pava

unread,
May 17, 2018, 11:38:00 AM5/17/18
to django-d...@googlegroups.com

I think the idea is that some developers may have fields on their models called “url” or “absolute_url” and having a property by that name would cause naming conflicts. (Actually, I think I ran into this issue once with my own projects.)  Creating any property on a model in the Django core would result in potential naming conflicts for all the projects that are out there.  Of course, there’s nothing stopping you from doing it in your local project, and you may want to create your own custom models.Model class to inherit from and use in all of your models.

--
You received this message because you are subscribed to the Google Groups "Django developers (Contributions to Django itself)" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-develop...@googlegroups.com.
To post to this group, send email to django-d...@googlegroups.com.
Visit this group at https://groups.google.com/group/django-developers.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-developers/b4d4dd2f-eaaa-4758-aa3a-22eade759fc8%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply all
Reply to author
Forward
0 new messages