> On Oct 31, 2014, at 3:26 PM, Torsten Bronger <bronger@physik.rwth-aachen.de> wrote:
>
> Hallöchen!
>
> Carl Meyer writes:
>
>>> On Oct 31, 2014, at 4:19 AM, Torsten Bronger <bronger@physik.rwth-aachen.de> wrote:
>>>
>>> [...]
>>>
>>> Do you mean this:
>>>
>>> class ExternalOperator(models.Model):
>>>
>>> name = models.CharField(_("name"), max_length=30, unique=True)
>>> natural_key_field = "name"
>>>
>>> It works (at least, it doesn't abort) but I thought only fields
>>> were allowed as attributes.
>>
>> Yes, that's what I mean (though usually for clarity I would place
>> any non-field attributes in a separate visual block - separated by
>> a blank line - from field attributes). There is no requirement
>> that all class attributes of models must be fields. Django can
>> tell which are subclasses of Field and ignores the others.
>
> See https://code.djangoproject.com/ticket/5793 -- can't this be
> solved by such attributes then? I wonder because I subscribed to
> this ticket long ago for a similar reason.
True - there's nothing you could do with custom Meta attributes that can't just as well be done with class attributes. The desire for custom Meta attributes is purely a matter of API aesthetics.
Carl
--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/80F5A802-AC01-4137-B3C0-B8DFC67D3F4D%40oddbird.net.
For more options, visit https://groups.google.com/d/optout.
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment