From: Jacob Hilker Date: Tue, 4 Feb 2014 21:28:54 +0000 (-0500) Subject: require points to edit courses X-Git-Tag: release-20150131~178^2 X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=refs%2Fpull%2F314%2Fhead;p=oweals%2Fkarmaworld.git require points to edit courses --- diff --git a/karmaworld/apps/users/models.py b/karmaworld/apps/users/models.py index 15af634..1d23004 100644 --- a/karmaworld/apps/users/models.py +++ b/karmaworld/apps/users/models.py @@ -38,6 +38,9 @@ class UserProfile(models.Model): return sum + def can_edit_courses(self): + return (self.get_points() >= 20) + NO_BADGE = 0 PROSPECT = 1 BEGINNER = 2 diff --git a/karmaworld/templates/courses/course_detail.html b/karmaworld/templates/courses/course_detail.html index 356a81c..1514190 100644 --- a/karmaworld/templates/courses/course_detail.html +++ b/karmaworld/templates/courses/course_detail.html @@ -68,7 +68,10 @@
{% if user.is_authenticated %} - edit_flag + {% if user.get_profile.can_edit_courses %} + edit_flag + {% endif %} + {% if already_flagged %} course_flag
-
-
- {% csrf_token %} + {% if user.get_profile.can_edit_courses %} +
+ + {% csrf_token %} -
-
- {{ course_form.non_field_errors }} +
+
+ {{ course_form.non_field_errors }} +
-
-
-
- School -
- +
+
+ School +
+ +
-
-
+
-
-
- Course Name: - -
-
+
+
+ Course Name: + +
+
-
-
- Instructor Name: - -
+
+
+ Instructor Name: + +
-
- Instructor Email: - -
-
+
+ Instructor Email: + +
+
-
-
- Course url: - -
-
+
+
+ Course url: + +
+
-
-
- +
+
+ +
-
- -
+ +
+ {% endif %}