Sunday, September 21, 2014

Re: new to django data modeling for an application

class Person(models.Model):
    name = models.CharField(max_length=100)
    email = models.EmailField()

    def __str__(self):
        return self.name


class Restaurant(models.Model):
    name = models.CharField(max_length=100)
    adress = models.CharField(max_length=200)

    def __str__(self):
        return self.name


class Dish(models.Model):
    restaurant = models.ForeignKey(Restaurant)
    name = models.CharField(max_length=200)
    description = models.TextField()

    def __str__(self):
        return self.name


should i connect the person to a restaurant some how?



On Friday, September 19, 2014 6:01:52 PM UTC-5, Collin Anderson wrote:
class Dish(models.Model):
    resturant
= models.ForeignKey(Resturant)
    name
= models.CharField(max_length=255)

--
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/3995927f-853d-4174-856c-c8819ec13548%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment