django-advanced-filters icon indicating copy to clipboard operation
django-advanced-filters copied to clipboard

Bug fixes

Open Robert-Lebedeu opened this issue 7 years ago • 6 comments

CHANGES:

  1. Templates:
    • Removed the title inside the change_form template.
    • Commented the _af_handler.destroy() call inside common_js_init because I didn't want to clean up every time the add rule button was pressed.
  2. Forms:
    • Changed isnull operator from None to 'None' (Before it wasn't working and with 'None' worked perfectly).
    • The value field now is not required anymore if you select one of these operators: 'isnull', 'istrue, 'isfalse' (Also the value field becomes a readonly field, in these cases).
    • I also removed the part that auto-selects the range operator with datetime fields. This was creating some issues and I thought it was a useless feature to keep in so I get rid of that part.
  3. Static:
    • Added try-catch when using Django-Grappelli and JQuery-UI
    • Changed the modify_widget
    • I found some functions that were called twice with out any valid reason, I commented that parts and this corrected some bugs (for example: now range operator works properly).
    • I also commented the field_selected(...).first() call because I thought that it didn't make any sense to re-initiate the first rule (this problem was forcing you to use always an equal operator as your first rule) .
    • I also changed the initialize_select2 function to set the autocomplete only with foreign keys and 'iexact' operator.

Robert-Lebedeu avatar Nov 06 '18 15:11 Robert-Lebedeu

This PR actually fixes a lot of JavaScript issues, can it be merged please?

lorenzomorandini avatar Feb 08 '19 10:02 lorenzomorandini

There's a failing test and a few dubious changes, but I'm sure it can be brought to shape. @lorenzomorandini would you care to review & test the code?

asfaltboy avatar Feb 08 '19 13:02 asfaltboy

Ok, I will review it

lorenzomorandini avatar Feb 11 '19 09:02 lorenzomorandini

Coverage Status

Coverage increased (+0.05%) to 95.969% when pulling b902218547bbbd95b6706b127b234f9e96e2b375 on Robert-Lebedeu:develop into 4f1575a67e751330606a9a3ee4f33eda5214b44e on modlinltd:develop.

coveralls avatar Feb 11 '19 10:02 coveralls

I've been trying this version for a few days and all javascript problems seem to have gone:

  • Datetime range works and does not duplicate when adding a new row
  • Select2 autocomplete appears only for foreign key fields
  • Works without django grappelli too

lorenzomorandini avatar Feb 28 '19 15:02 lorenzomorandini

Update: I'm working on a test suite for JS using selenium, once I am able to anchor all feature and reproduce the issues mentioned here, I this it will reduce the risk when merging this PR.

asfaltboy avatar Aug 07 '20 10:08 asfaltboy