This commit is contained in:
Julien Constant 2023-04-05 16:25:25 +02:00
parent ef968f3673
commit e4894d27ad
2 changed files with 7 additions and 3 deletions

View File

@ -719,8 +719,12 @@ class UserPreferencesView(UserTabsMixin, CanEditMixin, UpdateView):
def get_context_data(self, **kwargs):
kwargs = super(UserPreferencesView, self).get_context_data(**kwargs)
if not hasattr(self.object, "trombi_user"):
if not (
hasattr(self.object, "trombi_user") and self.request.user.trombi_user.trombi
):
kwargs["trombi_form"] = UserTrombiForm()
if hasattr(self.object, "customer"):
kwargs["student_card_form"] = StudentCardForm()
return kwargs

View File

@ -14,8 +14,8 @@
<hr>
<h4>{% trans %}Add user{% endtrans %}</h4>
<form action="" method="post">
{% csrf_token %}
{{ form.as_p() }}
{% csrf_token %}
{{ form.as_p() }}
<input type="submit" value="{% trans %}Add{% endtrans %}" />
</form>
<hr>