Friday, February 25, 2011

Model Question

I'm trying to cram the ORM into an existing schema and have an issue I
can't seem to get around.

I have a number of tables with a timestamp column, but the column name
is inconsistent. I would like to put the timestamp field in an
abstract superclass, but I can't seem to figure out how to override
the column name in the subclass. Can I do this?

Also, is there a better way to check for existence of a field in a
models.Manager method than the following:

def filteredResults(self):
qs = super(MyManager, self).get_query_set()
for field in qs.model._meta.fields:

It works, but not sure how hacky this is...

New to django and python (from primarily Java recently).

--
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