Hello!

Here's my problem. I am trying to design a simple wiki-like CMS, with
3 different types of editable pages.

1. Text
2. Images
3. Audio

All of these 3 have their own class, derived from an abstract base
class which contains things shared in common by them all (is this page
locked, last_changed_date, etc...) In my abstract Page class, I set:

class Meta:
    abstract = True

This creates 3 different tables for each of the subclasses.

Each page has a foreign key (called 'wrapper') that points to a giant
table with all of the article/page names.

Let's say I want to get the latest page for an image, I can have a
function that does something like this:

def getLatestPage(pageName, namespace):
  q = PageNameTable.objects.filter(namespace__exact=namespace)
  q = q.filter(name__exact=name)

  # get a list of all the objects pointing to this name
  # ***ImageTable hardcoded in?***
  revisions = ImageTable.objects.filter(wrapper__name__exact=name,
 
wrapper__namespace__exact=namespace)

  revisions = res.order_by('revision__changeDate')


This code works fine when I am using only Images. _But_ the ImageTable
is hardcoded in. I can't grab an object from a TextTable or
AudioTable. I thought of using python's 'eval()' to run the code, but
this seems like a bad idea maybe from a security point.

How can I make this code run on the different tables? Any ideas?

Is my database design completely screwed up, or can django help me
here?

Thank you!

--~--~---------~--~----~------------~-------~--~----~
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+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to