Пример #1
0
  def get(self):
    context = self.getContext()
    users = User.objects.all()

    result = [(i, user_profile_logic.getProfile(i)) for i in users]

    context['users'] = result

    content = loader.render_to_string('user/home.html', dictionary=context)
    return http.HttpResponse(content)
Пример #2
0
  def getGetForm(self):
    user_id = self.kwargs['user_id']
    user = User.objects.filter(id=user_id).get()
    groups = user.groups.all()
    profile = user_profile_logic.getProfile(user)

    initial = {
        'firstname': user.first_name,
        'lastname': user.last_name,
        'type': groups[0].id if groups else '',
        'read': [i.id for i in profile.read.all()],
        'write': [i.id for i in profile.write.all()],
        }

    return EditForm(initial=initial)