summaryrefslogtreecommitdiff
path: root/app/sightings/models.py
diff options
context:
space:
mode:
Diffstat (limited to 'app/sightings/models.py')
-rw-r--r--app/sightings/models.py14
1 files changed, 10 insertions, 4 deletions
diff --git a/app/sightings/models.py b/app/sightings/models.py
index 792c52b..80b9ba9 100644
--- a/app/sightings/models.py
+++ b/app/sightings/models.py
@@ -54,8 +54,10 @@ class AP(models.Model):
scientific_name = models.CharField(max_length=200)
code = models.IntegerField(choices=ABA_CODES, default=0)
apclass = models.ForeignKey(APClass, on_delete=models.CASCADE)
- image = models.FileField(upload_to=get_upload_path, null=True, blank=True, help_text="width of high res is 1360px")
- image_credit = models.CharField(max_length=200, blank=True, null=True)
+ body_html = models.TextField(null=True, blank=True)
+ body_markdown = models.TextField(null=True, blank=True)
+ #image = models.FileField(upload_to=get_upload_path, null=True, blank=True, help_text="width of high res is 1360px")
+ #image_credit = models.CharField(max_length=200, blank=True, null=True)
def __str__(self):
return self.common_name
@@ -75,6 +77,9 @@ class AP(models.Model):
ordering = ["common_name", ]
def save(self, *args, **kwargs):
+ if self.pk:
+ md = render_images(self.body_markdown)
+ self.body_html = markdown_to_html(md)
self.slug = slugify(self.common_name[:50])
super(AP, self).save(*args, **kwargs)
@@ -84,8 +89,8 @@ class Sighting(models.Model):
point = models.PointField(blank=True)
location = models.ForeignKey(Location, on_delete=models.CASCADE, blank=True)
pub_date = models.DateTimeField('Date', default=timezone.now)
- seen_by = models.ManyToManyField(User)
- images = models.ManyToManyField(LuxImage, blank=True)
+ #seen_by = models.ManyToManyField(User)
+ #images = models.ManyToManyField(LuxImage, blank=True)
#audio = models.ManyToManyField(BirdAudio, blank=True)
class Meta:
@@ -150,6 +155,7 @@ class Sighting(models.Model):
raise forms.ValidationError("There is no location associated with that point, add it: %sadmin/locations/location/add/" % (settings.BASE_URL))
super(Sighting, self).save()
+
"""
Migration from Birds to abstract:
apclass = OLDAPClass.objects.all()