Skip to content

Commit

Permalink
Make user account information readonly
Browse files Browse the repository at this point in the history
  • Loading branch information
tudoramariei committed Oct 3, 2024
1 parent 3bc1072 commit f92d73b
Show file tree
Hide file tree
Showing 2 changed files with 39 additions and 34 deletions.
5 changes: 4 additions & 1 deletion backend/donations/views/my_account.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,10 @@ class MyAccountDetailsView(BaseAccountView):

@method_decorator(login_required(login_url=reverse_lazy("login")))
def get(self, request, *args, **kwargs):
context = {"user": request.user}
user = request.user
is_ngohub_user: bool = user.is_ngohub_user

context = {"user": user, "is_ngohub_user": is_ngohub_user}
return render(request, self.template_name, context)

@method_decorator(login_required(login_url=reverse_lazy("login")))
Expand Down
68 changes: 35 additions & 33 deletions backend/templates/v1/ngo/my-account-details.html
Original file line number Diff line number Diff line change
@@ -1,46 +1,48 @@
{% extends "base.html" %}

{% block header %}
{% include "ngo/account-header.html" %}
{% include "ngo/account-header.html" %}
{% endblock %}

{% block content %}
<div class="container">
<div class="container">

<div class="row">
{% if errors %}
<div class="col-xs-12 col-md-6 col-md-offset-3">
<div class="alert alert-dismissible alert-danger">
<button type="button" class="close" data-dismiss="alert">×</button>
<strong>Oops!</strong> {{ errors }}
</div>
</div>
{% endif %}
{% if errors %}
<div class="col-xs-12 col-md-6 col-md-offset-3">
<div class="alert alert-dismissible alert-danger">
<button type="button" class="close" data-dismiss="alert">×</button>
<strong>Oops!</strong> {{ errors }}
</div>
</div>
{% endif %}
</div>

<div class="row">
<div class="col-xs-8 col-xs-offset-2 col-sm-6 col-sm-offset-3 col-lg-4 col-lg-offset-4">
<form class="form-horizontal" action="/date-cont/" role="form" method="post">
{{ csrf_input }}
<fieldset>
<legend>Datele contului tău</legend>
<div class="form-group">
<div class="col-xs-6">
<input class="form-control" type="text" name="nume" value="{{ user.last_name }}" placeholder="Nume" required />
</div>
<div class="col-xs-6">
<input class="form-control" type="text" name="prenume" value="{{ user.first_name }}" placeholder="Prenume" required />
</div>
</div>
<div class="form-group">
<div class="col-xs-12">
<input class="form-control" type="email" value="{{ user.email }}" placeholder="Email" readonly />
</div>
</div>
<button type="submit" class="btn btn-primary pull-right">Salvează</button>
</fieldset>
</form>
</div>
<div class="col-xs-8 col-xs-offset-2 col-sm-6 col-sm-offset-3 col-lg-4 col-lg-offset-4">
<form class="form-horizontal" action="/date-cont/" role="form" method="post">
{{ csrf_input }}
<fieldset>
<legend>Datele contului tău</legend>
<div class="form-group">
{% if not is_ngohub_user %}
<div class="col-xs-6">
<input class="form-control" type="text" name="nume" value="{{ user.last_name }}" placeholder="Nume" required {% if is_ngohub_user %}readonly{% endif %}/>
</div>
{% endif %}
<div class="{% if is_ngohub_user %}col-xs-12{% else %}col-xs-6{% endif %}">
<input class="form-control" type="text" name="prenume" value="{{ user.first_name }}" placeholder="Prenume" required {% if is_ngohub_user %}readonly{% endif %}/>
</div>
</div>
<div class="form-group">
<div class="col-xs-12">
<input class="form-control" type="email" value="{{ user.email }}" placeholder="Email" readonly/>
</div>
</div>
<button type="submit" class="btn btn-primary pull-right">Salvează</button>
</fieldset>
</form>
</div>
</div>
</div>
</div>
{% endblock %}

0 comments on commit f92d73b

Please sign in to comment.