Opened 5 years ago

Closed 4 years ago

#17697 closed New feature (needsinfo)

Implement a new property as list type (like extra_argument) into the ListView class

Reported by: sylock Owned by: Adrien Lemaire
Component: Generic views Version: 1.3
Severity: Normal Keywords: extra_context generic views listview
Cc: sylock, lemaire.adrien@… Triage Stage: Design decision needed
Has patch: no Needs documentation: yes
Needs tests: yes Patch needs improvement: no
Easy pickings: yes UI/UX: no



In the deprecated implementation of generic views (as functions) there was the extra_context list to pass extra arguments to the template.
Since 1.3 and the new implementation of generic views as classes doing the same need the creation of a new customized class which inherits from the ListView class as documented here (in the extra_context chapter):

It's not pythonic since the new implementation recquire more knowledge of the underlying code, and basicaly, more code to do the same! So it's a regression from my point of view.

It would be really simple to solve it keeping classes implementation by creating a new property as list type. So when instanciate the ListView class we would be able to give the extra variables as arguments.

Really need little modification to the existing code!

Change History (6)

comment:1 Changed 5 years ago by sylock

Cc: sylock added
Needs documentation: unset
Needs tests: unset
Patch needs improvement: unset
Type: UncategorizedNew feature

comment:2 Changed 5 years ago by Aymeric Augustin

Really need little modification to the existing code!

Would you mind attaching the changes you suggest as a diff file? That would make it easier to assess this ticket.

comment:3 Changed 5 years ago by Adrien Lemaire

Easy pickings: set
Needs documentation: set
Needs tests: set
Owner: changed from nobody to Adrien Lemaire
Triage Stage: UnreviewedAccepted

comment:4 Changed 5 years ago by Adrien Lemaire

Cc: lemaire.adrien@… added

comment:5 Changed 5 years ago by Adrien Lemaire

Triage Stage: AcceptedDesign decision needed

I think it would be a good idea to add back the extra_context kwarg, that would allow a user to give the extra context in the directly for small views.

The extra_context has to be a dict @sylock, you need to specify the key and value for that extra context.

Nevertheless, there might be a good reason why that extra_context field has been removed from the function based views to class based views, so I'd like a core developer to confirm whereas I can work on that new feature or not. I'll have to change several parts of the doc as well, so maybe I'll have to add a note in the release/1.4.txt, or 1.5-alpha-1.txt if we're not gonna add that patch in 1.4.

comment:6 Changed 4 years ago by Aymeric Augustin

Resolution: needsinfo
Status: newclosed

Without code, I'm not sure what changes are requested by this ticket. Please create a patch or a pull request.

Note: See TracTickets for help on using tickets.
Back to Top