Tuesday, April 11, 2023

Re: Beginner: How to find fields that can be over-ridden in a Generic Class Based Views

Hello Pulkit,
Information you are asking is not readily available. It will become clear to you as you start writing code. 

However, you can use below options to make your life easier.
  1. https://ccbv.co.uk
  2. dir and callable methods can help you get more clarity. 

I hope it helps you.

Regards,
Chetan Ganji
+91-900-483-4183


On Tue, Apr 11, 2023 at 6:14 PM PULKIT AGRAWAL <plktagrawal@gmail.com> wrote:
Hello Everyone,

I am very new to Django and am still learning the ropes. If anyone can point me in the right direction, I will be thankful to you.

My problems is as follows:
1. I have learned about class based views and have started using them
2. But every now and then I come across a new field that could have been overwritten in the class based view to shorted the code
3. Is there a way to identify all the fields that can be over written in a class based view.

Let me illustrate with an example:
class UnitCreateView(CreateView):
    form_class = UnitCreationForm
    template_name = 'units_of_measurement/unit_create.html'
    success_url = reverse_lazy('units_of_measurement:unit_list')

In the above class, can I know how many and what other fields such as "form_class" are available to over-riding? I have checked the documentation but have not found anything. Maybe its just me.

Thanks in advance!

Regards,

Plkt

--
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+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/1666860d-5b3a-4cc8-a4b4-0187f5dc5b48n%40googlegroups.com.

--
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+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/CAMKMUjtB5yFCX7%2Bc9HgYNzzR7Jak8cOaXV6MEJQwyJVftzpTHg%40mail.gmail.com.

No comments:

Post a Comment