Sample.py includes the following:
==================================
from django.db import models
class Good(models.Model):
code = models.CharField(max_length=64)
quizid = models.IntegerField(null=False, blank=False)
published_on = models.DateTimeField(auto_now_add=True)
class Fails(models.Model):
code = models.CharField(max_length=64)
quizid = models.IntegerField(null=False, blank=False)
published_on = models.DateTimeField(auto_now_add=True)
def __init__(self, *args, **kwargs):
super(Fails, self).__init__(args, kwargs)
===========================
python manage.py shell
>>> from Sample import Good,Fails
>>> g = Good()
>>> f = Fails()
>>> type(g.id)
<type 'NoneType'>
>>> type(f.id)
<type 'tuple'>
Why-O-Why does the type(f.id) != type(g.id)
The reason this matters is because when I call Fails.save(), I get
this message:
Exception Type: TypeError
Exception Value: int() argument must be a string or a number, not
'tuple'
What I can't understand is why overriding __init__() causes this
behavior. My code needs to do something in __init__(), but even when
I remove all that it is doing, the model underneath changes the type
of the id column.....
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---