I need:

1) If a user has created a object of the class by a form, then he sees the 
button which calls the webpage of the object detail.

2)  If a user didn't create a object of the class, but another user did it, 
then he sees the button which calls this form to create a object and the 
user will be a author this object.

3) If a user didn't create a object of the class by a form, then he sees 
the button which calls this form.


If a user didn't create a object of the class, but another user did it, 
then he sees the button which calls this form to create a object and the 
user will be a author this object.


I made this:


{% if list %}
    {% for i in list %}
        {% if request.user == i.author %}
            <a class="btn" href="{% url 'detail' i.id %}" role="button">
              {{i.detail}}
            </a>
        {% else %}
           <button type="button" class="btn" data-toggle="modal" 
data-target="#form">
                 Кнопка для вызова формы
           </button>
        {% endif %}
    {% endfor %}
    </div>{% else %}
    <button type="button" class="btn btn-primary mr-4" data-toggle="modal" 
data-target="#digital">
      Кнопка для вызова формы
    </button>{% endif %}


But if a user created a object of the class, then he sees both button.

-- 
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 django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/5844076b-d426-40db-bc93-1dfa7d5be510%40googlegroups.com.

Reply via email to