Author: brosner
Date: Thu Sep 11 00:30:45 2008
New Revision: 868
Modified:
trunk/pinax/local_apps/photos/views.py
Log:
Missed the photo add to projects from r867.
Modified: trunk/pinax/local_apps/photos/views.py
==============================================================================
--- trunk/pinax/local_apps/photos/views.py (original)
+++ trunk/pinax/local_apps/photos/views.py Thu Sep 11 00:30:45 2008
@@ -67,8 +67,12 @@
if request.method == "POST" and request.POST["action"]
== "add_to_project":
projectid = request.POST["project"]
myproject = Project.objects.get(pk=projectid)
- myproject.photos.create(photo=photo)
- request.user.message_set.create(message=_("Successfully add
photo '%s' to project") % title)
+ if not myproject.photos.filter(photo=photo).count():
+ myproject.photos.create(photo=photo)
+ request.user.message_set.create(message=_("Successfully
add photo '%s' to project") % title)
+ else:
+ # TODO: this applies to pinax in general. dont use
ugettext_lazy here. its usage is fragile.
+ request.user.message_set.create(message=_("Did not add
photo '%s' to project because it already exists.") % title)
# TODO: figure out why reverse doesn't work and redo this
return render_to_response("photos/details.html", {
"host": host,
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"pinax-updates" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/pinax-updates?hl=en
-~----------~----~----~----~------~----~------~--~---