Answers for "give class to fields in modelform django"

0

django deleteview class

##### views.py #####
from django.urls import reverse_lazy
from django.views.generic.edit import DeleteView
from myapp.models import Author

class AuthorDelete(DeleteView):
    model = Author
    success_url = reverse_lazy('author-list')
    
##### author_confirm_delete.html #####
<form method="post">{% csrf_token %}
    <p>Are you sure you want to delete "{{ object }}"?</p>
    <input type="submit" value="Confirm">
</form>
Posted by: Guest on April-17-2020
0

django model get field verbose name

model._meta.get_field('location_x').verbose_name
Posted by: Guest on May-14-2020

Code answers related to "give class to fields in modelform django"

Python Answers by Framework

Browse Popular Code Answers by Language