annotate membermap/models.py @ 693:ad69236e8501

For issue #52, update many 3rd party Javascript libraries. Updated to jquery 1.10.2, jquery ui 1.10.3. This broke a lot of stuff. - Found a newer version of the jquery cycle all plugin (3.0.3). - Updated JPlayer to 2.4.0. - Updated to MarkItUp 1.1.14. This also required me to add multiline attributes set to true on various buttons in the markdown set. - As per a stackoverflow post, added some code to get multiline titles in a jQuery UI dialog. They removed that functionality but allow you to put it back. Tweaked the MarkItUp preview CSS to show blockquotes in italic. Did not update TinyMCE at this time. I'm not using the JQuery version and this version appears to work ok for now. What I should do is make a repo for MarkItUp and do a vendor branch thing so I don't have to futz around diffing directories to figure out if I'll lose changes when I update.
author Brian Neal <bgneal@gmail.com>
date Wed, 04 Sep 2013 19:55:20 -0500
parents ee87ea74d46b
children 6164cc091649
rev   line source
gremmie@1 1 """
gremmie@1 2 Models for the member map application.
gremmie@1 3 """
bgneal@266 4 import datetime
gremmie@1 5 from django.db import models
gremmie@1 6 from django.contrib.auth.models import User
gremmie@1 7
bgneal@153 8 from core.markup import site_markup
gremmie@1 9
bgneal@153 10
gremmie@1 11 class MapEntry(models.Model):
gremmie@1 12 """Represents a user's entry on the map."""
gremmie@1 13 user = models.ForeignKey(User)
gremmie@1 14 location = models.CharField(max_length=255)
gremmie@1 15 lat = models.FloatField()
gremmie@1 16 lon = models.FloatField()
gremmie@1 17 message = models.TextField(blank=True)
bgneal@266 18 html = models.TextField(blank=True)
bgneal@266 19 date_updated = models.DateTimeField()
gremmie@1 20
gremmie@1 21 def __unicode__(self):
bgneal@266 22 return u'Map entry for %s' % self.user.username
gremmie@1 23
gremmie@1 24 class Meta:
gremmie@1 25 ordering = ('-date_updated', )
gremmie@1 26 verbose_name_plural = 'map entries'
gremmie@1 27
bgneal@182 28 def save(self, *args, **kwargs):
bgneal@266 29 self.html = site_markup(self.message)
bgneal@266 30 self.date_updated = datetime.datetime.now()
bgneal@182 31 super(MapEntry, self).save(*args, **kwargs)
gremmie@1 32