Please ignore this dumn-ass p
On 26 Jan 2011, at 12:34, Adrian Bool wrote:

> 
> On 26 Jan 2011, at 12:26, Jaroslav Dobrek wrote:
> 
>>> 
>>> http://docs.djangoproject.com/en/1.2/ref/models/fields/#unique
>> Example:
>> 
>> This should be allowed:
>> 
>> car1: manufacturer = "foo", name = "bar"
>> car2: manufacturer = "foo", name = "baz"
>> 
>> This should not be allowed:
>> 
>> car1: manufacturer = "foo", name = "bar"
>> car2: manufacturer = "foo", name = "bar"
> 
> Doesn't look to be directly possible from the Django's API; but I guess you 
> could,
> 
> class Car(models.Model):
>       manufacturer = models.CharField(max_length=127)
>       name = models.CharField(max_length=127)
>       manufacturer_name = models.CharField(max_length=256, unique=True)
> 
>    def save(self, *args, **kwargs):
>        manufacturer_name = "%s_%s" % (self.manufacturer, self.name)
>        super(Charge, self).save(*args, **kwargs)
> 


Urgh.  Please ignore this dis-information.  Hat off to Chris for knowing what 
he types.

aid


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