Thanks in advance to anyone who replies to this.
I just started using Django and I'm creating a sample blog application
in which within this application more than one blog is represented,
and each blog has a one-to-many relationship with tags, as well as a
one-to-many relationship with entries.
Individually these are simple, but the part I can't quite figure out
is how to simply ensure via the admin interface that if I create a new
tag for an entry that the tag also become associated with the blog for
the entry.
Also if anyone has done this could I easily add some ajax into the
administration panel so if when I'm adding an Entry and I select via
the dropdown the blog to associate with it a ajax request is sent to
the server to get the list of tags already associated with the blog?
The idea here is that as an author of one blog I am only listed tags
that are associated with my blog.
As a previous php web developer I could manually code this up, however
I don't know where to begin in Django.
Also if this doesn't seem possible, can I run two separate instances
of a blog application on the same server? Given the database structure
it seems if I duplicate the code as another application it will work,
but this slightly voids the DRY principle as I'll have two or more
copies of the same code.
The relavant code I currently am using:
class Blog(models.Model):
title = models.CharField(maxlength=200)
class Admin:
pass
class Tag(models.Model):
title = models.CharField(maxlength=20,core=True)
blog = models.ForeignKey(Blog, edit_inline=models.TABULAR,
num_in_admin=1)
class Entry(models.Model):
blog = models.ForeignKey(Blog)
title = models.CharField(maxlength=200)
tags = models.ManyToManyField(Tag)
class Admin:
pass
Thanks,
Bryce Boe
http://www.bryceboe.com
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Django users" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---