Permalink
Browse files

removed remaining references to django_revisions

  • Loading branch information...
1 parent 31a013b commit 9a37e2ec82c19f9c7db7e26f609c859a44b69e3f @patrickbaumann committed Sep 14, 2011
Showing with 9 additions and 27 deletions.
  1. +1 −3 example/settings.py
  2. +0 −1 geocamMemo/forms.py
  3. +1 −3 geocamMemo/models.py
  4. +0 −2 geocamMemo/views.py
  5. +7 −18 geocamTalk/models.py
View
@@ -70,7 +70,6 @@
MIDDLEWARE_CLASSES = (
'django.middleware.common.CommonMiddleware',
'django.contrib.sessions.middleware.SessionMiddleware',
- 'revisions.middleware.VersionedModelRedirectMiddleware',
'django.contrib.auth.middleware.AuthenticationMiddleware',
)
@@ -93,6 +92,5 @@
'django.contrib.sessions',
'django.contrib.sites',
'geocamMemo',
- 'geocamTalk',
- 'revisions'
+ 'geocamTalk'
)
View
@@ -5,7 +5,6 @@
# __END_LICENSE__
from django import forms
-from revisions.admin import AutoRevisionForm
from geocamMemo.models import MemoMessage
from datetime import datetime
import re
View
@@ -17,8 +17,6 @@ class Meta:
server_timestamp = models.DateTimeField(auto_now_add = True)
author = models.ForeignKey(User, related_name="%(app_label)s_%(class)s_set")
content = models.TextField(max_length=1024)
- # removed auto_add_now from content_timestamp since revisions are also instances in the
- # same table and we don't overwrite this timestamp on an edit
content_timestamp = models.DateTimeField(blank=True)
latitude = models.FloatField(null=True, blank=True)
longitude = models.FloatField(null=True, blank=True)
@@ -83,7 +81,7 @@ def fromJson(messageDict):
def getMessages(author=None):
""" Message Listing Rules:
- If no author is specified: all messages are displayed (latest revisions)
+ If no author is specified: all messages are displayed
If author is specified: all messages are displayed from author
"""
View
@@ -77,8 +77,6 @@ def create_message(request):
form = MemoMessageForm(request.POST)
if form.is_valid():
msg = form.save(commit=False)
- # Since revisions are now saved to db, this timestamp
- # can't just be auto set since we want to preserve from creation time
msg.content_timestamp = datetime.now()
msg.save()
return HttpResponseRedirect(reverse('memo_message_list_all'))
View
@@ -27,19 +27,8 @@ def getUnreadMessageCount(self):
User.profile = property(lambda u: TalkUserProfile.objects.get_or_create(user=u)[0])
class TalkMessage(GeocamMessage):
- """ This is the data model for Memo application messages
+ """ This is the data model for Memo application messages """
- Some of the Versioned Model API:
- VersionedModel.get_latest_revision()
- VersionedModel.get_revisions()
- VersionedModel.make_current_revision()
- VersionedModel.revert_to(criterion)
- VersionedModel.save(new_revision=True, *vargs, **kwargs)
- VersionedModel.show_diff_to(to, field)
- complete API and docs are here:
- http://stdbrouw.github.com/django-revisions/
-
- """
#TODO - add time to filename location
audio_file = models.FileField(null=True, blank=True, upload_to='geocamTalk/audio/%Y/%m/%d') #"%s-audio" % (GeocamMessage.author))
@@ -87,25 +76,25 @@ def fromJson(messageDict):
def getMessages(recipient=None, author=None):
""" Message Listing Rules:
- If no users are specified: all messages are displayed (latest revisions)
+ If no users are specified: all messages are displayed
If only author is specified: all messages are displayed from author
If only recipient is specified: messages displayed are broadcast + from OR to recipient
If both recipient AND author are specified: messages displayed are braodcast + from author AND to recipient
Note: a broadcast message is a message with no recipients
"""
if (recipient is None and author is None):
- # all messages are displayed (latest revisions)
- messages = TalkMessage.latest.all()
+ # all messages are displayed
+ messages = TalkMessage.objects.all()
elif (recipient is None and author is not None):
# messages displayed are from author:
- messages = TalkMessage.latest.filter(author__username=author.username)
+ messages = TalkMessage.objects.filter(author__username=author.username)
elif (recipient is not None and author is None):
# messages displayed are broadcast + from OR to recipient:
- messages = TalkMessage.latest.annotate(num_recipients=Count('recipients')).filter(Q(num_recipients=0) | Q(recipients__username=recipient.username) | Q(author__username=recipient.username)).distinct()
+ messages = TalkMessage.objects.annotate(num_recipients=Count('recipients')).filter(Q(num_recipients=0) | Q(recipients__username=recipient.username) | Q(author__username=recipient.username)).distinct()
else:
# messages displayed are braodcast + from author AND to recipient
- messages = TalkMessage.latest.annotate(num_recipients=Count('recipients')).filter(Q(num_recipients=0) | Q(recipients__username=recipient.username)).filter(author__username=author.username).distinct()
+ messages = TalkMessage.objects.annotate(num_recipients=Count('recipients')).filter(Q(num_recipients=0) | Q(recipients__username=recipient.username)).filter(author__username=author.username).distinct()
return messages.order_by('-content_timestamp')
@staticmethod

0 comments on commit 9a37e2e

Please sign in to comment.