Hello everyone,

I have a form. All users see this form. My needs is like this;
- If user logged in, save their settings.
- If user doesn't logged in, first show him a modal
- If he login or sign up, close modal and save their settings. (settings 
shouldn't be lost.)


For now my template looks like this;

...
{% 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">&times;</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 %}
...

How can i do that?

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/da0ee366-457a-496b-9884-960e61c16fff%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to