Re: [Django] #34966: Add a check for ModelAdmin.actions functions not taking three arguments

2023-11-14 Thread Django
#34966: Add a check for ModelAdmin.actions functions not taking three arguments
-+-
 Reporter:  Riccardo |Owner:  nobody
  Magliocchetti  |
 Type:  New feature  |   Status:  closed
Component:  contrib.admin|  Version:  dev
 Severity:  Normal   |   Resolution:  wontfix
 Keywords:  admin actions| Triage Stage:
 |  Unreviewed
Has patch:  0|  Needs documentation:  0
  Needs tests:  0|  Patch needs improvement:  0
Easy pickings:  0|UI/UX:  0
-+-

Comment (by Riccardo Magliocchetti):

 Hello Natalia, thanks for the answer, I'll implement something locally, no
 big deal. BTW I was referring to the ModelAdmin checks
 https://docs.djangoproject.com/en/4.2/ref/checks/#modeladmin where stuff
 is checked by its type.

-- 
Ticket URL: 
Django 
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-updates+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/0107018bce4a60af-4f85c27f-9681-449f-878e-f3cc09c07c1d-00%40eu-central-1.amazonses.com.


Re: [Django] #34966: Add a check for ModelAdmin.actions functions not taking three arguments

2023-11-14 Thread Django
#34966: Add a check for ModelAdmin.actions functions not taking three arguments
-+-
 Reporter:  Riccardo |Owner:  nobody
  Magliocchetti  |
 Type:  New feature  |   Status:  closed
Component:  contrib.admin|  Version:  dev
 Severity:  Normal   |   Resolution:  wontfix
 Keywords:  admin actions| Triage Stage:
 |  Unreviewed
Has patch:  0|  Needs documentation:  0
  Needs tests:  0|  Patch needs improvement:  0
Easy pickings:  0|UI/UX:  0
-+-

Comment (by Natalia Bidart):

 Replying to [comment:3 Riccardo Magliocchetti]:
 > Hello Natalia, we are already unit testing the admin actions but not
 through the testing client, i.e. we are testing the function and not
 posting data to the model admin view. I have to say I'm not really
 thrilled to start doing so for every action. I thought that the check
 would have been in the same spirit as the other checks on the fields
 though. Thanks.

 Hi Riccardo,

 Regarding testing the actions exercising the whole request stack (ie using
 the test client, for example): I agree is not trivial, but I still think
 is necessary, if anything as a way of integration/functional testing.

 Regarding whether the proposed check is in the same spirit of existing
 checks, I beg to differ. IMHO, existing checks are about ensuring
 *semantic* correctness of various parts and pieces of the framework as a
 tool ("''does the `max_length` parameter makes sense for an
 `IntegerField`''"), not so much about ensuring syntactic/static checking
 ("''is this method being called with the right amount of params''"). The
 former is a manageable sized-set, while the latter could grow tremendously
 making the checks non performant, hard to manage and very hard to
 maintain.

 As documented in the [https://docs.djangoproject.com/en/4.2/topics/checks/
 System check framework], the checks are extensible, so your project could
 define as many custom checks as you consider necessary. Besides that, and
 following my professional experience, there are common practices like
 having a `dev` and/or `staging` environments where code is deployed before
 reaching production, allowing for these type of errors to be caught
 earlier.

 Suffices to say that, ultimately, is up to you and your company what kind
 of tests and testing environments are used, but from the point of view of
 Django, the framework can not possible provide checks for every
 potentially incorrect method or function call.

-- 
Ticket URL: 
Django 
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-updates+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/0107018bce37e8aa-74888989-c552-496f-a350-d7f27997c7da-00%40eu-central-1.amazonses.com.


Re: [Django] #34966: Add a check for ModelAdmin.actions functions not taking three arguments

2023-11-14 Thread Django
#34966: Add a check for ModelAdmin.actions functions not taking three arguments
-+-
 Reporter:  Riccardo |Owner:  nobody
  Magliocchetti  |
 Type:  New feature  |   Status:  closed
Component:  contrib.admin|  Version:  dev
 Severity:  Normal   |   Resolution:  wontfix
 Keywords:  admin actions| Triage Stage:
 |  Unreviewed
Has patch:  0|  Needs documentation:  0
  Needs tests:  0|  Patch needs improvement:  0
Easy pickings:  0|UI/UX:  0
-+-
Changes (by Riccardo Magliocchetti):

 * cc: Riccardo Magliocchetti (added)


Comment:

 Hello Natalia, we are already unit testing the admin actions but not
 through the testing client, i.e. we are testing the function and not
 posting data to the model admin view. I have to say I'm not really
 thrilled to start doing so for every action. I would have thought that the
 check would have been in the same spirit as the other checks on the fields
 though. Thanks.

-- 
Ticket URL: 
Django 
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-updates+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/0107018bcd7d50de-6d222929-aa30-486d-870e-b92cad171138-00%40eu-central-1.amazonses.com.


Re: [Django] #34966: Add a check for ModelAdmin.actions functions not taking three arguments

2023-11-13 Thread Django
#34966: Add a check for ModelAdmin.actions functions not taking three arguments
-+-
 Reporter:  Riccardo |Owner:  nobody
  Magliocchetti  |
 Type:  New feature  |   Status:  closed
Component:  contrib.admin|  Version:  dev
 Severity:  Normal   |   Resolution:  wontfix
 Keywords:  admin actions| Triage Stage:
 |  Unreviewed
Has patch:  0|  Needs documentation:  0
  Needs tests:  0|  Patch needs improvement:  0
Easy pickings:  0|UI/UX:  0
-+-
Changes (by Natalia Bidart):

 * status:  new => closed
 * resolution:   => wontfix


Comment:

 Hello Riccardo, thank you for your ticket and interest to make Django
 better.

 I understand your report, but Django can not possibly add checks for every
 function or method signature that Django users create when using the
 framework. In my experience, these errors are better caught by unit tests,
 there are plenty of examples in the Django source code and in other open
 projects that would provide examples about how to test Admin actions.

 Did you have unit tests that did not catch this? If so, perhaps you could
 seek further help in how to improve/fix those by using any of the user
 support channels from [https://docs.djangoproject.com/en/dev/faq/help
 /#how-do-i-do-x-why-doesn-t-y-work-where-can-i-go-to-get-help this link].
 I'll be closing this ticket as wontfix following the
 [https://docs.djangoproject.com/en/4.2/internals/contributing/triaging-
 tickets/#closing-tickets ticket triaging process].

 Thanks again!

-- 
Ticket URL: 
Django 
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-updates+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/0107018bc8c0bfde-8d17c575-42ce-4eb9-b6a3-70fa688ad285-00%40eu-central-1.amazonses.com.


Re: [Django] #34966: Add a check for ModelAdmin.actions functions not taking three arguments (was: add checks for ModelAdmin.actions functions not taking three arguments)

2023-11-12 Thread Django
#34966: Add a check for ModelAdmin.actions functions not taking three arguments
-+-
 Reporter:  Riccardo |Owner:  nobody
  Magliocchetti  |
 Type:  New feature  |   Status:  new
Component:  contrib.admin|  Version:  dev
 Severity:  Normal   |   Resolution:
 Keywords:  admin actions| Triage Stage:
 |  Unreviewed
Has patch:  0|  Needs documentation:  0
  Needs tests:  0|  Patch needs improvement:  0
Easy pickings:  0|UI/UX:  0
-+-

-- 
Ticket URL: 
Django 
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-updates+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/0107018bc33120b6-aa205203-6d78-46b6-b48c-c8680ab3d715-00%40eu-central-1.amazonses.com.