I have a form. All users see this form. My needs is like this;
- If user logged in, save their settings.
- If he login or sign up, close modal and save their settings. (settings shouldn't be lost.)
...
{% if request.user.is_authenticated %}
<form action="/socials/create/{{ link_id }}/" method="post">
{% csrf_token %}
{{ form }}
###form fields
<input type="submit" value="Create"> </p>
</form>
{% else %}
<p>Henüz üye girişi yapmadınız yada üye değilsiniz!</p>
<form action="/socials/create/{{ link_id }}/" method="post">
{% csrf_token %}
{{ form }}
###form fields
</form>
<button class="btn btn-primary btn-lg" data-toggle="modal" data-target="#myModal">Create</button>
<!-- Modal -->
<div class="modal fade" id="myModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal"><span aria-hidden="true">×</span><span class="sr-only">Close</span></button>
<h4 class="modal-title" id="myModalLabel">Welcome</h4>
</div>
<div class="modal-body">
<p>In order to save your changes, you have to login or sign up!</p>
<a href="/accounts/facebook/login/" target="_blank">Login with Facebook</a>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
</div>
</div>
</div>
</div>
<!-- Button trigger modal -->
{% endif %}
...