TemplateView and FormView inconsistency

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

TemplateView and FormView inconsistency

step21
Hi all,

When developing I noticed an inconsistency - when using TemplateView, kwargs are passed to context, but not when using FormView or others.

Source comparison:

https://dpaste.de/Jwdn

Relevant super old issue talking about depreciation here:
https://code.djangoproject.com/ticket/19878

I discussed this briefly on IRC and was told to post here, as it is an inconsistency and maybe should be fixed but maybe wasn’t for a reason. Seeing as there was already talk of depreciating it several years ago and no clear opposition, maybe I could prepare a patch for it?
Any thoughts?

F

--
You received this message because you are subscribed to the Google Groups "Django developers  (Contributions to Django itself)" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/django-developers/5072B2EE-D2B4-448C-936D-C5FDB5CD7132%40devtal.de.

signature.asc (499 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: TemplateView and FormView inconsistency

Adam Johnson-2
Hi,

After reading the ticket, I agree this could be deprecated as a backwards incompatibility. The deprecation plan suggested by loic84 looks like it could work but would be a bit unwieldy on large projects. Maybe there's another path?

One thing that's not explicitly in the discussion: the view kwargs are always accessible inside templates because ContextMixin.get_context_data passes 'view', and view.kwargs is always set by View.setup().

Thanks,

Adam

On Wed, 14 Aug 2019 at 01:56, step21 <[hidden email]> wrote:
Hi all,

When developing I noticed an inconsistency - when using TemplateView, kwargs are passed to context, but not when using FormView or others.

Source comparison:

https://dpaste.de/Jwdn

Relevant super old issue talking about depreciation here:
https://code.djangoproject.com/ticket/19878

I discussed this briefly on IRC and was told to post here, as it is an inconsistency and maybe should be fixed but maybe wasn’t for a reason. Seeing as there was already talk of depreciating it several years ago and no clear opposition, maybe I could prepare a patch for it?
Any thoughts?

F

--
You received this message because you are subscribed to the Google Groups "Django developers  (Contributions to Django itself)" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/django-developers/5072B2EE-D2B4-448C-936D-C5FDB5CD7132%40devtal.de.


--
Adam

--
You received this message because you are subscribed to the Google Groups "Django developers (Contributions to Django itself)" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/django-developers/CAMyDDM1Jxg468YdVyLMkhQnuaCq7E9VVB3ucJkRXSNptKRXTDQ%40mail.gmail.com.
Reply | Threaded
Open this post in threaded view
|

Re: TemplateView and FormView inconsistency

step21
I do not have a better idea right now, but also do not know the django core code that well. Personally, as you could get all TemplateViews via Ack or another code search method, I do not think replacing them would take long.

Am 14.08.2019 um 09:45 schrieb Adam Johnson <[hidden email]>:

Hi,

After reading the ticket, I agree this could be deprecated as a backwards incompatibility. The deprecation plan suggested by loic84 looks like it could work but would be a bit unwieldy on large projects. Maybe there's another path?

One thing that's not explicitly in the discussion: the view kwargs are always accessible inside templates because ContextMixin.get_context_data passes 'view', and view.kwargs is always set by View.setup().

Thanks,

Adam

On Wed, 14 Aug 2019 at 01:56, step21 <[hidden email]> wrote:
Hi all,

When developing I noticed an inconsistency - when using TemplateView, kwargs are passed to context, but not when using FormView or others.

Source comparison:

https://dpaste.de/Jwdn

Relevant super old issue talking about depreciation here:
https://code.djangoproject.com/ticket/19878

I discussed this briefly on IRC and was told to post here, as it is an inconsistency and maybe should be fixed but maybe wasn’t for a reason. Seeing as there was already talk of depreciating it several years ago and no clear opposition, maybe I could prepare a patch for it?
Any thoughts?

F

--
You received this message because you are subscribed to the Google Groups "Django developers  (Contributions to Django itself)" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/django-developers/5072B2EE-D2B4-448C-936D-C5FDB5CD7132%40devtal.de.


--
Adam

--
You received this message because you are subscribed to the Google Groups "Django developers (Contributions to Django itself)" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/django-developers/CAMyDDM1Jxg468YdVyLMkhQnuaCq7E9VVB3ucJkRXSNptKRXTDQ%40mail.gmail.com.

--
You received this message because you are subscribed to the Google Groups "Django developers (Contributions to Django itself)" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/django-developers/53F53122-8D8E-40BE-ADB9-F9AE77E737DA%40devtal.de.

signature.asc (499 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: TemplateView and FormView inconsistency

Adam Johnson-2
I came up with a PR that will raise a deprecation warning on variable access - see the ticket.

On Wed, 14 Aug 2019 at 14:46, step21 <[hidden email]> wrote:
I do not have a better idea right now, but also do not know the django core code that well. Personally, as you could get all TemplateViews via Ack or another code search method, I do not think replacing them would take long.

Am 14.08.2019 um 09:45 schrieb Adam Johnson <[hidden email]>:

Hi,

After reading the ticket, I agree this could be deprecated as a backwards incompatibility. The deprecation plan suggested by loic84 looks like it could work but would be a bit unwieldy on large projects. Maybe there's another path?

One thing that's not explicitly in the discussion: the view kwargs are always accessible inside templates because ContextMixin.get_context_data passes 'view', and view.kwargs is always set by View.setup().

Thanks,

Adam

On Wed, 14 Aug 2019 at 01:56, step21 <[hidden email]> wrote:
Hi all,

When developing I noticed an inconsistency - when using TemplateView, kwargs are passed to context, but not when using FormView or others.

Source comparison:

https://dpaste.de/Jwdn

Relevant super old issue talking about depreciation here:
https://code.djangoproject.com/ticket/19878

I discussed this briefly on IRC and was told to post here, as it is an inconsistency and maybe should be fixed but maybe wasn’t for a reason. Seeing as there was already talk of depreciating it several years ago and no clear opposition, maybe I could prepare a patch for it?
Any thoughts?

F

--
You received this message because you are subscribed to the Google Groups "Django developers  (Contributions to Django itself)" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/django-developers/5072B2EE-D2B4-448C-936D-C5FDB5CD7132%40devtal.de.


--
Adam

--
You received this message because you are subscribed to the Google Groups "Django developers (Contributions to Django itself)" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/django-developers/CAMyDDM1Jxg468YdVyLMkhQnuaCq7E9VVB3ucJkRXSNptKRXTDQ%40mail.gmail.com.

--
You received this message because you are subscribed to the Google Groups "Django developers (Contributions to Django itself)" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/django-developers/53F53122-8D8E-40BE-ADB9-F9AE77E737DA%40devtal.de.


--
Adam

--
You received this message because you are subscribed to the Google Groups "Django developers (Contributions to Django itself)" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/django-developers/CAMyDDM1e%2B77AP00YgBXq7tXPmj9MrcsKVqJFUMdXMkstxy7HMQ%40mail.gmail.com.