Jacob Smullyan avatar Jacob Smullyan committed f0e3e26

fixes for site

Comments (0)

Files changed (2)


         ordering = ('-starts_at',)
     title = models.CharField(max_length=80)
-    slug = models.SlugField(unique=True)
+    slug = models.SlugField()
     description = models.TextField(blank=True)
     starts_at = models.DateTimeField(default=datetime.datetime.now)
     is_published = models.BooleanField(default=False)
     site = models.ForeignKey(Site)
+    class Meta:
+        unique_together = (('slug', 'site'),)
     def __unicode__(self):
         return self.title


 def _get_emailform_or_404(request, slug):
-    if request.user.is_staff:
-        return get_object_or_404(EmailForm.objects, slug=slug)
-    else:
-        return get_object_or_404(EmailForm.live, slug=slug)
+    mgr = EmailForm.objects if request.user.is_staff else EmailForm.live
+    return get_object_or_404(mgr, slug=slug, site=settings.SITE_ID)
 def _emailform_submit(request, emailform, embed=False):
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.