models.py 621 B

12345678910111213141516171819202122
  1. from django.db import models
  2. from gauth.models import Location
  3. class YelpLocation(models.Model):
  4. location = models.OneToOneField(Location, on_delete=models.CASCADE)
  5. url = models.URLField()
  6. def __str__(self):
  7. return self.location.care_name
  8. class YelpReview(models.Model):
  9. reviewer_name = models.CharField(max_length=255)
  10. profile = models.URLField()
  11. rating = models.IntegerField()
  12. date_posted = models.DateTimeField()
  13. comment = models.TextField()
  14. location = models.ForeignKey(YelpLocation, on_delete=models.CASCADE)
  15. def __str__(self):
  16. return self.reviewer_name