[Oi-commits] r1110 - trunk/forum

oi-commits at pardus.org.tr oi-commits at pardus.org.tr
Wed Mar 5 17:59:35 EET 2008


Author: jnmbk
Date: Wed Mar  5 17:59:35 2008
New Revision: 1110

Modified:
   trunk/forum/forms.py
   trunk/forum/models.py
Log:
first post's edit goes to topic edit (but it needs editing support for tags)

Modified: trunk/forum/forms.py
=================================================================
--- trunk/forum/forms.py	(original)
+++ trunk/forum/forms.py	Wed Mar  5 17:59:35 2008
@@ -27,7 +27,7 @@
     def clean_tags(self):
         field_data = self.cleaned_data['tags']
 
-        # we don't want users to choice tags more than 5
+        # we don't want users to choose more than 5 tags
         if len(field_data) > 5:
             raise forms.ValidationError("En fazla 5 tag seçebilirsiniz. Lütfen açtığınız başlığa uygun tag seçin")
 

Modified: trunk/forum/models.py
=================================================================
--- trunk/forum/models.py	(original)
+++ trunk/forum/models.py	Wed Mar  5 17:59:35 2008
@@ -59,7 +59,11 @@
         return '/forum/%s/%s/quote/%s/' % (self.topic.forum.slug, self.topic.id, self.id)
 
     def get_edit_url(self):
-        return '/forum/%s/%s/edit/%s/' % (self.topic.forum.slug, self.topic.id, self.id)
+        """ returns topic edit url if it's first post """
+        if self.topic.post_set.order_by("created")[0].id == self.id:
+            return '/forum/%s/%s/edit/' % (self.topic.forum.slug, self.topic.id)
+        else:
+            return '/forum/%s/%s/edit/%s/' % (self.topic.forum.slug, self.topic.id, self.id)
 
     def get_hide_url(self):
         return '/forum/%s/%s/hide/%s/' % (self.topic.forum.slug, self.topic.id, self.id)


More information about the Oi-commits mailing list