]> git.parisson.com Git - teleforma.git/commitdiff
simplify users context
authoryomguy <yomguy@parisson.com>
Fri, 27 Apr 2012 23:55:40 +0000 (01:55 +0200)
committeryomguy <yomguy@parisson.com>
Fri, 27 Apr 2012 23:55:40 +0000 (01:55 +0200)
teleforma/management/commands/teleforma-import-users.py
teleforma/templates/telemeta/users.html
teleforma/views.py

index 08a783fb27edb9b159f67f658f927600a5faa853..3be53fe1648c28c57221e3225dafe63022031a0e 100644 (file)
@@ -22,7 +22,7 @@ class Command(BaseCommand):
         first_name  = row[1].value
         email       = row[9].value
         #FIXME:
-        #email       = self.admin_email
+        email       = self.admin_email
         username = slugify(first_name)[0] + '.' + slugify(last_name)
         username = username[:30]
         date = row[14].value
@@ -31,7 +31,7 @@ class Command(BaseCommand):
         #FIXME: not for prod
         user = User.objects.filter(username=username)
         if user:
-            user[0].delete()
+            user.delete()
 
         user, created = User.objects.get_or_create(username=username, first_name=first_name,
                                      last_name=last_name, email=email, date_joined = date_joined)
index fc0e9f6e0dbba94e850b711db6edff0c8517e1f0..4e5cf35a2880000bfd41e30f0cae2b9e6b1ae502 100644 (file)
@@ -51,9 +51,9 @@
 </div>
 </div>
 
-{% if all_users %}
+{% if users %}
 <div class="module_action">
-<a href="{% url postman_write all_users|to_recipients %}" class="component_icon button" id="action_orange">{% trans "Grouped message" %}</a>
+<a href="{% url postman_write users|to_recipients %}" class="component_icon button" id="action_orange">{% trans "Grouped message" %}</a>
 </div>
 {% endif %}
 
index dc2ff91462be7be85a2a656cd6bea0d2ec8c122d..543bdc66a4e27d3d98eed05a79dfa41ddc915e61 100755 (executable)
@@ -212,7 +212,6 @@ class UsersView(ListView):
     def get_context_data(self, **kwargs):
         context = super(UsersView, self).get_context_data(**kwargs)
         context['trainings'] = Training.objects.all()
-        context['all_users'] = User.objects.all()
         context['iejs'] = IEJ.objects.all()
         context['courses'] = Course.objects.all()
         paginator = NamePaginator(self.object_list, on="last_name", per_page=12)
@@ -256,7 +255,6 @@ class UsersTrainingView(UsersView):
     def get_context_data(self, **kwargs):
         context = super(UsersTrainingView, self).get_context_data(**kwargs)
         context['training'] = Training.objects.get(id=self.args[0])
-        context['all_users'] = self.object_list.all()
         return context
 
     @method_decorator(login_required)
@@ -272,7 +270,6 @@ class UsersIejView(UsersView):
     def get_context_data(self, **kwargs):
         context = super(UsersIejView, self).get_context_data(**kwargs)
         context['iej'] = IEJ.objects.get(id=self.args[0])
-        context['all_users'] = self.object_list.all()
         return context
 
     @method_decorator(login_required)
@@ -288,7 +285,6 @@ class UsersCourseView(UsersView):
     def get_context_data(self, **kwargs):
         context = super(UsersCourseView, self).get_context_data(**kwargs)
         context['course'] = Course.objects.get(id=self.args[0])
-        context['all_users'] = self.object_list.all()
         return context
 
     @method_decorator(login_required)