From f584542483ff903dd6a100e6b3d5ebca65b79937 Mon Sep 17 00:00:00 2001 From: Jacob Hilker Date: Tue, 4 Feb 2014 16:28:54 -0500 Subject: [PATCH] require points to edit courses --- karmaworld/apps/users/models.py | 3 + .../templates/courses/course_detail.html | 91 ++++++++++--------- 2 files changed, 51 insertions(+), 43 deletions(-) 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 %}

-- 2.25.1