I am having trouble returning a list given a model. The model I have:
class Club(models.Model):
establishment = models.CharField(max_length=200)
address = models.CharField(max_length=200)
def __unicode__(self):
return self.establishment
class Available(models.Model):
club = models.ForeignKey(Club)
court = models.CharField(max_length=200)
avail_time = models.DateTimeField('available time')
def __unicode__(self):
return self.court
I am trying to run “Available.objects.filter(club=”AV Club”) but I get “ValueError: invalid literal for int() with base 10: ‘AV Club'”. My end goal is to be able to return the list of avail_times given a club.
Any ideas on how to fix? This is probably a super basic problem, but I’m new to django and have been banging my head on this. Thanks!
clubarg should be either aClubinstance or its pk (integer in your case). You need this