Im using django .96-pre and searched the bug page but didn't find
anything relevant.

Here is my code model to create a 'tag' like datamodel for my blog
entries :

class Blog(models.Model):
   title = models.CharField(maxlength=200)
   body = models.TextField()
   pub_date = models.DateTimeField('date published')
   def __str__(self):
       return self.title
   def was_published_today(self):
       return self.pub_date.date() == datetime.date.today()
   was_published_today.short_description = 'Published today?'

   class Admin:
       pass
       list_display = ('title', 'pub_date', 'was_published_today')
       list_filter = ['pub_date']
       search_fields = ['title']
       date_hierarchy = 'pub_date'

class Tag(models.Model):
   name = models.CharField(maxlength=100)
   blog = models.ManyToManyField(Blog)
   def __str__(self):
       return self.name

   class Admin:
       pass

Now when running `python manage.py sqlall` i see :

ninjastance $ python manage.py sqlall blogs
BEGIN;
CREATE TABLE `blogs_blog` (
   `id` integer AUTO_INCREMENT NOT NULL PRIMARY KEY,
   `title` varchar(200) NOT NULL,
   `body` longtext NOT NULL,
   `pub_date` datetime NOT NULL
);
CREATE TABLE `blogs_tag` (
   `id` integer AUTO_INCREMENT NOT NULL PRIMARY KEY,
   `name` varchar(100) NOT NULL
);
CREATE TABLE `blogs_tag_blog` (
   `id` integer AUTO_INCREMENT NOT NULL PRIMARY KEY,
   `tag_id` integer NOT NULL REFERENCES `blogs_tag` (`id`),
   `blog_id` integer NOT NULL REFERENCES `blogs_blog` (`id`),
   UNIQUE (`tag_id`, `blog_id`)
);
CREATE INDEX blogs_comment_blog_id ON `blogs_comment` (`blog_id`);
COMMIT;

However, running `python manage.py syncdb` doesn't create table
`blogs_tag_blog` for the many to many relation. Am I missing a
particular column to finish the relation or is it a possible bug?

Thanks
adam


--~--~---------~--~----~------------~-------~--~----~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to