i have a model class as below. *(please observe the red color lines)*

class NewsEntry(models.Model):
      *noofshares = models.IntegerField(default=0)**
      ispopular = models.BooleanField(default=0)     *
      pdate = models.DateField(db_index=True)
      publisheddate = models.DateTimeField()
      populardate = models.DateTimeField(null=True)
      entryids = models.TextField(default='')

------------------------------------------

THe sql which is generating for the above model class is

BEGIN;
CREATE TABLE `pystories_newsentry` (
    `id` integer AUTO_INCREMENT NOT NULL PRIMARY KEY,
   * `noofshares` integer NOT NULL,**
    `ispopular` bool NOT NULL,*
    `pdate` date NOT NULL,
    `entryids` longtext NOT NULL
)
;
CREATE INDEX `pystories_newsentry_pdate` ON `pystories_newsentry` (`pdate`);
COMMIT;

ideally the  sql should be as below considering the default values   which
we have specified.

Can any one  please guide me on  the mistake that iam doing because of which
the default values are not reflected in the above sql.


BEGIN;
CREATE TABLE `pystories_newsentry` (
    `id` integer AUTO_INCREMENT NOT NULL PRIMARY KEY,
    *`noofshares` integer NOT NULL DEFAULT 0,**
    `ispopular` bool NOT NULL DEFAULT 0,*
    `pdate` date NOT NULL,
    `entryids` longtext NOT NULL
)
;
CREATE INDEX `pystories_newsentry_pdate` ON `pystories_newsentry` (`pdate`);
COMMIT;

----------------------------------------------------------



--rama

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