0

I want to be able to CRUD data from my django-db through the view.py.

{% extends 'home/base.html' %}
{% load crispy_forms_tags %}
{% block content %}
        <form method="POST" action ="{% url 'twitter'  %}" enctype="multipart/form-data">
            {% csrf_token %}
            <fieldset="form-group">
                <legend class="border-bottom mb-4">Twitter Information</legend>
                {{ tw|crispy }}
            </fieldset>
            <div class="form-group">
        </form>
            <div class="form-group">
                <button class="btn btn-outline-info" type="submit">Submit</button>
                <button class="btn btn-info" type="submit">Update</button>
                <button class="btn btn-dark" type="reset">Reset</button>
                <a href="{% url 'twitter_container.twitter-edit' %}"  class="btn btn-danger" type="submit">Delete</a>
        </form>
{% endblock content %}

twitter_container.twitter-edit is a view in my view.py. I'm trying to call this function on button clicked.

1 Answers1

0

In order to call a function in views.py with HTML button, you need to use AJAX in javascript.

Check this out for more info.

Abdulaziz0
  • 128
  • 5