Model

class mdlcountry(models.Model):
    class Meta:
        verbose_name_plural = "Countries"        
    country_id = models.AutoField(primary_key=True,null=False,blank=False)
    country_name =
models.CharField(max_length=100,unique=True,null=False,blank=False,verbose_name='Country
Name')
                       
    def save(self, *args, **kw): 
       super(mdlroomtypes, self).save(*args, **kw)
    
          
    def __str__(self):
        return self.country_name 


How to raise error if india country name alredy exists in database and again
the user is trying to insert india.

Regards
radhika
-- 
View this message in context: 
http://old.nabble.com/How-to-raise-integrity-error-in-save-method-of-model-tp28328713p28328713.html
Sent from the django-users mailing list archive at Nabble.com.

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