Mercurial > public > sg101
view membermap/models.py @ 1166:130ac1e98cf4
More V3 forums tweaking.
Adding attachments is working now.
Adding a post via ajax is working.
Still need to display attachments on posts.
author | Brian Neal <bgneal@gmail.com> |
---|---|
date | Sun, 20 Aug 2017 15:55:54 -0500 |
parents | f0ac48aa8c64 |
children |
line wrap: on
line source
""" Models for the member map application. """ import datetime from django.db import models from django.contrib.auth.models import User from core.markup import site_markup class MapEntry(models.Model): """Represents a user's entry on the map.""" user = models.ForeignKey(User) location = models.CharField(max_length=255) lat = models.FloatField() lon = models.FloatField() message = models.TextField(blank=True) html = models.TextField(blank=True) date_updated = models.DateTimeField() def __unicode__(self): return u'Map entry for %s' % self.user.username class Meta: ordering = ('-date_updated', ) verbose_name_plural = 'map entries' def save(self, *args, **kwargs): self.html = kwargs.pop('html', '') if not self.html and self.message: self.html = site_markup(self.message) self.date_updated = datetime.datetime.now() super(MapEntry, self).save(*args, **kwargs)