Hi dudes,

My object seems mysterious, as is my problem ... I'd like to
understand something (it's much more related to Python than Django).

Take an example :

class Image(models.Model):
    email = models.ForeignKey('Email', verbose_name=_(u'Email'))
    name = models.CharField(_(u'Name'), max_lenth=50,
help_text=_(u'Must be unique for a given email'))
    content_id = models.CharField(_(u'Content ID'), max_length=25,
db_index=True, default=self.slugify_name())
    [...]

"self" is not defined in the "default" kwarg for "content_id" field,
it's because I'm not in an instance method (with self as first
parameter). So what are those members, are they static for the class ?
What is the difference between them and a member instantiated in the
__init__ method whith self.field = [...] ?

If I replace the last field definition with :

from django.template.defaultfilters import slugify
[...]
    content_id = models.CharField(_(u'Content ID'), max_length=25,
db_index=True, default=slugify(name))

Eclipse don't show me an error ... will it work ? Why (not) ? I'm not
sure to understand what I'm doing and it's weird.

Thanks you for reading, I hope I'll understand !

PS : Sorry for my poor English.

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@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