Exemplo n.º 1
0
def policies_settings(request):
    return render(
        request, 'settings/policy.html', {
            "current_user": request.user,
            "page": "policies",
            "policies": get_latest_policies()
        })
Exemplo n.º 2
0
 def get_context_data(self, **kwargs):
     kwargs = super(InformationRegistrationView,
                    self).get_context_data(**kwargs)
     kwargs.update({
         "help_email": settings.HELP_EMAIL,
         "policies": get_latest_policies()
     })
     return kwargs
Exemplo n.º 3
0
 def sign_in(self, user=None):
     if not user:
         user = self.user
     # We agree to #allthethings, so let us in!
     for policy in get_latest_policies():
         user.policies = {policy: datetime.datetime.now().strftime("%d/%m/%y %H:%M")}
     user.save()
     self.client.force_login(user)
Exemplo n.º 4
0
    def save(self, commit=True):
        user, _new = User.objects.get_or_create(email=self.cleaned_data["email"])
        user.set_password(self.cleaned_data["password1"])
        user.first_name = self.cleaned_data["first_name"]
        user.last_name = self.cleaned_data["last_name"]
        user.information = {
            "uses": self.cleaned_data['use'].split(','),
            "locations": self.cleaned_data['location'].split(','),
            "space_needed": self.cleaned_data['storage'],
            "heard_from": self.cleaned_data['source'],
        }

        latest_policies = get_latest_policies()
        user.policies = {k: datetime.datetime.now().strftime("%d/%m/%y %H:%M") for k, v in latest_policies.items()}

        if commit:
            user.save()

        return user
Exemplo n.º 5
0
    def save(self, commit=True):
        user, _new = User.objects.get_or_create(email=self.cleaned_data["email"])
        user.set_password(self.cleaned_data["password1"])
        user.first_name = self.cleaned_data["first_name"]
        user.last_name = self.cleaned_data["last_name"]
        user.information = {
            "uses": self.cleaned_data['use'].split(','),
            "locations": self.cleaned_data['location'].split(','),
            "space_needed": self.cleaned_data['storage'],
            "heard_from": self.cleaned_data['source'],
        }

        latest_policies = get_latest_policies()
        user.policies = {k: datetime.datetime.now().strftime("%d/%m/%y %H:%M") for k, v in latest_policies.items()}

        if commit:
            user.save()

        return user
Exemplo n.º 6
0
 def get_context_data(self, **kwargs):
     kwargs = super(InformationRegistrationView, self).get_context_data(**kwargs)
     kwargs.update({"help_email": settings.HELP_EMAIL, "policies": get_latest_policies()})
     return kwargs