Honza Král wrote: > subclassing currently does not work, it is still in development
Humm, after some thinking, I'm also subclassing the models.Model. This would generate a all the *Field fields which would be a problem. Then generating the sql syntax for subclasses should then be explicitly given I suppose. I was just trying to reuse my code as "Django follows the DRY Principle". :) Thanks. Regards, > On 5/10/06, Alex <[EMAIL PROTECTED]> wrote: > >>Hello all, >> >>I'm new to Django. :) >> >>I'm following the online tutorial. I'm created a application called >>"browser" and I'm writing my models. And I'm running into a subclassing >>problem. Here is my code: >> >>from django.db import models >> >>class BasicContact: >> contact_name = models.CharField(maxlength=50) >> contact_email = models.EmailField() >> contact_phone = models.CharField(maxlength=30) >> contact_mobile = models.CharField(maxlength=30) >> contact_fax = models.CharField(maxlength=30) >> contact_address = models.TextField(maxlength=200) >> contact_city = models.CharField(maxlength=50) >> contact_zipcode = models.IntegerField(maxlength=5) >> contact_country = models.CharField(maxlength=2) >> >>class Client(models.Model, BasicContact): >> name = models.CharField(maxlength=50) >> tv_channel = models.CharField(maxlength=50) >> web_site = models.URLField() >> comments = models.TextField(maxlength=1024) >> >> >>And then I'm getting the following mysql output: >> >>$ python manage.py sql browser >> >>BEGIN; >>CREATE TABLE `browser_client` ( >> `id` integer AUTO_INCREMENT NOT NULL PRIMARY KEY, >> `name` varchar(50) NOT NULL, >> `tv_channel` varchar(50) NOT NULL, >> `web_site` varchar(200) NOT NULL, >> `comments` longtext NOT NULL >>); >>COMMIT; >> >>Shouldn't it generate the needed code from subclassing ? : >> >> `contact_name` varchar(50) NOT NULL, >> `contact_email` varchar(75) NOT NULL, >> `contact_phone` varchar(30) NOT NULL, >> `contact_mobile` varchar(30) NOT NULL, >> `contact_fax` varchar(30) NOT NULL, >> `contact_address` longtext NOT NULL, >> `contact_city` varchar(50) NOT NULL, >> `contact_zipcode` integer NOT NULL, >> `contact_country` varchar(2) NOT NULL >> >>Any idea ? >> >>Regards, >>AC. >> >> >> > > > -- > Honza Král > E-Mail: [EMAIL PROTECTED] > ICQ#: 107471613 > Phone: +420 606 678585 > > > > > -- Alexandre CONRAD - TLV Research & Development tel : +33 1 30 80 55 05 fax : +33 1 30 80 55 06 6, rue de la plaine 78860 - SAINT NOM LA BRETECHE FRANCE --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---