Closed NaturalBornCamper closed 2 years ago
I think the problem is: forwarding generic ids of ctypeid-objid breaks because it was just never implemented :joy:
So, it's OPEN for contribution !
@NaturalBornCamper Thank you for the great writeup ! Maybe you want to give it a shot ? Or have you found another solution ?
No worries!
Unfortunately I have already uninstalled and implemented my own autocomplete, but thanks anyways :)
Maybe you were using Select2QuerySetSequenceView, apparently you need to use Select2QuerySetSequenceAutoView for GFK support.
Not sure if that's clearly documented, from what I see both classes could just be merged so that it would work out of the box next time.
@Guilouf Select2QuerySetSequenceAutoView is yours, is BC the reason you didn't want to change Select2QuerySetSequenceView.get_queryset ? If so, let's go ahead and merge the classes to have a single S2QSS view that works with forward OOTB. Otherwise, there might be a proper objection and I'd love to know more about it !
Hello @jpic, it's hard to remember but i will take a look at it this afternoon after my working time
@Guilouf thanks for the fast answer, please let me know if you have any objection to merging both classes, also, I think we can maintain BC with something like Select2QuerySetSequenceAutoView = Select2QuerySetSequenceView
@jpic Functionality seems to be broken, maybe because of this commit: https://github.com/yourlabs/django-autocomplete-light/commit/053554937475e1a34a5e48de5bf6d66c90e9de45 (reverting made the test page http://127.0.0.1:8000/admin/select2_generic_foreign_key/tmodel/49/change/ working for me)
I really struggle with the tests, i tried tox -e py38-dj30
but it gives me 16 passed for 23 errors..
The first thing to address may be the sensibility of the tests, but i can't find a way to run test selectively, maybe you have some tricks ?
In fact, i think the commit is incompatible with querysetSequence, and may also cause problem to Select2QuerySetSequenceView
@Guilouf tests are all passing for me with tox -r -e py38-dj30
and tox -r -e py38-dj31
with a resulting coverage of 90%, have you tried not touching anything while the browser tests are running ? it can fail if there is any interaction by mistake
I'm a bit confused if the commit in question breaks everything, or if it's just when using the new feature.
Is the new feature breaking your own code ?
@jpic Actually it was an issue related to selenium and geckodriver, now tests all passing.
The commit in question (https://github.com/yourlabs/django-autocomplete-light/commit/053554937475e1a34a5e48de5bf6d66c90e9de45) is breaking my code, i think it makes BaseQuerySetView
not supporting QuerysetSequence
objects, i have this error:
django-autocomplete-light/src/dal/views.py", line 148, in get_search_results
queryset = queryset.filter(reduced)
TypeError: filter() takes 1 positional argument but 2 were given
I couldn't however figuring out exaclty why it's appening
Got something in #1199 but it depends on a contribution to django-querysetsequence, let's hope they release something soonish.
Would love some reviews, even if it's just to say lgtm if that's really how you feel about it:
qss.distinct()
https://github.com/clokep/django-querysetsequence/pull/77qss.filter(*args)
https://github.com/clokep/django-querysetsequence/pull/76
Using the Autocompletion for GenericForeignKey with django-cities-light to make a form with country select, then region select, then city select chained autocompletes,
I can make all 3 fields show up together, but the moment I use the filtering from other fields, it seems to ignore my parameters and sends an invalid AJAX request that obviously fails:
The AJAX request I'm getting when using either
('state_or_county', 'region_id')
or('state_or_county', 'region')
is: http://localhost:8000/ProspectForm_139965457246160_autocomp?forward={"state_or_county":"61-64"} Which should be: http://localhost:8000/ProspectForm_139965457246160_autocomp?forward={"region_id":"61-64"} The value is fetched correctly from the first value in the Tuple, but it's also trying to filter the cities with the tuple first value instead of the second tuple value. In fact, whatever I put in the second tuple value seems to be completely ignored.Furthermore,
field_id='name'
also seems to be completely ignored and the value shown is always the default table model field (display_name
). Not sure if I should report this as another bug.For reference, the
django-cities-light
Region
andCity
models go as follows: