Skip to content

Instantly share code, notes, and snippets.

@AtufaShireen
Last active September 6, 2020 18:52
Show Gist options
  • Save AtufaShireen/9481a0932733b91f384f81262ea81334 to your computer and use it in GitHub Desktop.
Save AtufaShireen/9481a0932733b91f384f81262ea81334 to your computer and use it in GitHub Desktop.
{%load widget_tweaks%}
{%block body%}
<h1 class='title'>{{user.username}}</h1>
<img src="{{user.profile.pic.url}}" alt="Aimeri basking in the sun" class="circle"><br/>
{{user.profile.bio}}
<button class="button" onclick="myFunction()"> Update Your Details</button>
<form method='POST' action="" enctype="multipart/form-data">
{%csrf_token%}
{%for hidden in u_form.hidden_fields%}
{{hidden}}
{%endfor%}
{%for field in u_form.visible_fields%}
<div class="form-group">
<label for="{{field.id_for_label}}">{{field.label}}</label>
{{field|add_class:'form-control'}}
{%for error in field.errors%}
<span class="help-block">{{error}}</span>
{%endfor%}
</div>
{%endfor%}
{%for hidden in p_form.hidden_fields%}
{{hidden}}
{%endfor%}
{%for field in p_form.visible_fields%}
<div class="form-group">
{% if field.name == 'pic' %}
{{ field|add_class:"upload"|attr:"id=getval" }}
{% elif field.name == 'bio' %}
<label for="{{field.id_for_label}}">{{field.label}}</label>
{{ field|add_class:"bio" }}
</div>
{%else%}
<label for="{{field.id_for_label}}">{{field.label}}</label>
{{field|add_class:'form-control'}}
{%endif%}
{%for error in field.errors%}
<span class="help-block">{{error}}</span>
{%endfor%}
{%endfor%}
<button type="submit" class="btn btn-success">submit</button>
</form>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment