hi,
i like to output an error message if this date allready exist. has someone an idea?
class Bet(models.Model):
name = models.CharField(max_length=30, verbose_name='Name')
date = models.DateTimeField(verbose_name='Datum')
def __unicode__(self):
return self.name
def save(self):
newDate = self.date
try:
Bet.objects.get(date=newDate)
## error message and return to form
except Bet.DoesNotExist:
super(Bet, self).save()