API for Calendars
This commit is contained in:
@@ -9,10 +9,12 @@ class Calendar(models.Model):
|
||||
name = models.CharField(max_length=31, unique=True)
|
||||
shortcode = models.CharField(max_length=3, unique=True)
|
||||
desc = models.TextField(blank=True, null=True)
|
||||
published = models.BooleanField(default=False)
|
||||
|
||||
|
||||
class Meta:
|
||||
verbose_name_plural = "Calendars"
|
||||
ordering = ['name',]
|
||||
ordering = ['-published', 'id',]
|
||||
|
||||
def __unicode__(self):
|
||||
return "%s" % self.shortcode
|
||||
@@ -29,6 +31,7 @@ class Scraper(models.Model):
|
||||
new_items = models.IntegerField(blank=True, null=True)
|
||||
last_ran = models.DateTimeField(blank=True, null=True)
|
||||
|
||||
|
||||
class Meta:
|
||||
verbose_name_plural = "Scrapers"
|
||||
ordering = ['name',]
|
||||
@@ -78,7 +81,7 @@ class Organization(models.Model):
|
||||
address_type = models.CharField(max_length=31, blank=True, null=True)
|
||||
address_complete = models.CharField(max_length=63, blank=True, null=True)
|
||||
|
||||
|
||||
cal = models.ForeignKey(Calendar, on_delete=models.CASCADE, related_name="cal_events")
|
||||
barrio = models.CharField(max_length=127, blank=True, null=True)
|
||||
city = models.CharField(max_length=31, blank=True, null=True)
|
||||
state = models.CharField(max_length=15, blank=True, null=True)
|
||||
@@ -113,15 +116,15 @@ class Organization(models.Model):
|
||||
|
||||
class Event(models.Model):
|
||||
EVENT_TYPE = (
|
||||
('Ot', 'Other'),
|
||||
('Mu', 'Music'),
|
||||
('Ot', '🤔'),
|
||||
('Mu', '🎶'),
|
||||
('Va', 'Visual Art'),
|
||||
('Gv', 'Government'),
|
||||
('Gv', '🛠️'),
|
||||
('Ce', 'Civic Engagement'),
|
||||
('Ed', 'Educational'),
|
||||
('Ed', '🍎'),
|
||||
('Ma', 'Mutual Aid'),
|
||||
('Th', 'Theater'),
|
||||
('Co', 'Comedy'),
|
||||
('Th', '🎭'),
|
||||
('Co', '🍿'),
|
||||
)
|
||||
EVENT_STATE = (
|
||||
('live', 'Live & Direct'),
|
||||
@@ -134,7 +137,7 @@ class Event(models.Model):
|
||||
show_date = models.DateTimeField()
|
||||
show_day = models.DateField()
|
||||
|
||||
calendar = models.ManyToManyField(Calendar, blank=True, null=True)
|
||||
calendar = models.ManyToManyField(Calendar, blank=True, null=True, related_name="events")
|
||||
scraper = models.ForeignKey(Scraper, on_delete=models.CASCADE, null=True)
|
||||
venue = models.ForeignKey(Organization, on_delete=models.CASCADE)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user