Mercurial > public > sg101
comparison membermap/models.py @ 581:ee87ea74d46b
For Django 1.4, rearranged project structure for new manage.py.
author | Brian Neal <bgneal@gmail.com> |
---|---|
date | Sat, 05 May 2012 17:10:48 -0500 |
parents | gpp/membermap/models.py@4532ed27bed8 |
children | 6164cc091649 |
comparison
equal
deleted
inserted
replaced
580:c525f3e0b5d0 | 581:ee87ea74d46b |
---|---|
1 """ | |
2 Models for the member map application. | |
3 """ | |
4 import datetime | |
5 from django.db import models | |
6 from django.contrib.auth.models import User | |
7 | |
8 from core.markup import site_markup | |
9 | |
10 | |
11 class MapEntry(models.Model): | |
12 """Represents a user's entry on the map.""" | |
13 user = models.ForeignKey(User) | |
14 location = models.CharField(max_length=255) | |
15 lat = models.FloatField() | |
16 lon = models.FloatField() | |
17 message = models.TextField(blank=True) | |
18 html = models.TextField(blank=True) | |
19 date_updated = models.DateTimeField() | |
20 | |
21 def __unicode__(self): | |
22 return u'Map entry for %s' % self.user.username | |
23 | |
24 class Meta: | |
25 ordering = ('-date_updated', ) | |
26 verbose_name_plural = 'map entries' | |
27 | |
28 def save(self, *args, **kwargs): | |
29 self.html = site_markup(self.message) | |
30 self.date_updated = datetime.datetime.now() | |
31 super(MapEntry, self).save(*args, **kwargs) | |
32 |