Monday, May 23, 2011

created/modified base abstract class?

In my latest project I have have a few models that need to have a created/modified date/time non-editable fields.

I was wondering what would be the best way to handle this... Should create a base abstract class:

https://gist.github.com/987022

... and have the models that need those fields extend it, or would it be better to just add the created/modified/save() to each model that needs those fields?

For some reason, I like the thought of extending (avoids duplication and follows the DRY principle), but I was just curious what the Django professionals thought about this approach/technique?

Thanks!
Micky


--
You received this message because you are subscribed to the Google Groups "Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to django-users+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.

No comments:

Post a Comment