Code Monkey home page Code Monkey logo

Comments (10)

asfaltboy avatar asfaltboy commented on August 26, 2024

I believe our mixin, being a partial/mixin (or sub-class) implementation of a ModelAdmin, should be placed before the admin.ModelAdmin in the class declaration. This SO answer explains it nicely. Try using this line and tell me how it goes:

class CurriculoAdmin(AdminAdvancedFiltersMixin, admin.ModelAdmin):
...

EDIT: In fact, taking a look at the code, this whole situation can be avoided by simply having our mixin inheriting from object instead of ModelAdmin over at admin.py module.

from django-advanced-filters.

mpena2099 avatar mpena2099 commented on August 26, 2024

New error:

TypeError at /admin/curriculos/curriculo/
init() takes at least 2 arguments (1 given)

in /(...)/advanced_filters/admin.py in changelist_view
81. response = self.adv_filters_handle(request, kwargs)

:-/

from django-advanced-filters.

asfaltboy avatar asfaltboy commented on August 26, 2024

First of all, thanks for checking @mpena2099! It's rare to see visitors around here :)
As you must have noticed, the code hadn't been touched for quite a while.

But it's not to say the package wasn't being used. On the contrary, the application has evolved quite a bit from the initial state it was in when I initially published it to github (while still using the same core functionality).

In fact, the interest you've shown has motivated me to merge the changes from our branch into github as well as add some documentation, to the best of my ability.

I suggest you follow this thread as I will reference it when I finally push the update, hopefully that won't be too long from now.

from django-advanced-filters.

mpena2099 avatar mpena2099 commented on August 26, 2024

Thanks @asfaltboy! :D

from django-advanced-filters.

mpena2099 avatar mpena2099 commented on August 26, 2024

Advanced Filter button created but... don't do nothing.

First of all, it is necessary to add 'easy_select2' to INSTALLED_APPS. Now I see the errors below on error console from Safari:

[Warning] Invalid CSS property declaration at: * (select2.min.css, line 1)
[Error] TypeError: 'undefined' is not a function (evaluating 'e(window)')
    (função anônima) (jquery.magnific-popup.js, line 4)
[Error] ReferenceError: Can't find variable: grp
    global code (advanced-filters.js, line 154)
[Error] TypeError: 'undefined' is not an object (evaluating '$.magnificPopup.instance')
    (função anônima) (curriculo, line 327)
[Error] Failed to load resource: the server responded with a status of 404 (Not Found) (http://127.0.0.1:8000/static/easy_select2/vendor/jquery/jquery.js, line 0)

from django-advanced-filters.

marklr avatar marklr commented on August 26, 2024

Is your STATIC_ROOT configured properly?

from django-advanced-filters.

mpena2099 avatar mpena2099 commented on August 26, 2024

Yes @marklr, and I ran the command "collectstatic"...

from django-advanced-filters.

asfaltboy avatar asfaltboy commented on August 26, 2024

Hi @mpena2099, first of all you are right, easy_selecty2 should be added to support easy_select2 field usage. Will have to add this to the docs.

Second, our use case platform uses django-grappelli, hence the templates provided occasionally reference grp elements, as explained in the readme.

This might need some clarification in the docs, but basically anything (templates and static js/css files) can be overridden for different styling and front-end functionality, if desired. Take a peek in the js/html files, and let me know if you still have trouble implementing your own (non grappelli) template/frontend.

I believe our current frontend implementation requires jquery, and easy_select2 providе their own (in their "static/vendor" directory, as explained here.

If you are debugging locally there is no need to run collectstatic, rather make sure you have DEBUG turned on and the staticfiles app is enabled.

from django-advanced-filters.

asfaltboy avatar asfaltboy commented on August 26, 2024

@mpena2099; I decided that we might as well use the jQuery bundled with easy_select2 if we're gonna require them.

So this commit should now fix the issues you had when using the changelist on a non-grappelli.

Please note that the change form (for editing existing filters), still overrides grappelli's template, and will require another commit to fix. I've listed this in the short TODO list in the readme. So anyone can feel free to chime in and submit pull request on these things whenever they have some time.

from django-advanced-filters.

mpena2099 avatar mpena2099 commented on August 26, 2024

Hi!

OK, now it works... with Grappelli! (I was already thinking of using it in my project)

But... without Grappelli still some errors (ALL, I think, related to Grappelli):

[Error] ReferenceError: Can't find variable: grp
    global code (actions.js, line 136)
[Error] TypeError: 'undefined' is not a function (evaluating '$(document)')
    (função anônima) (curriculo, line 29)
[Error] TypeError: 'undefined' is not an object (evaluating '$.fn')
    (função anônima) (orig_inlines.js, line 18)
[Error] TypeError: 'undefined' is not a function (evaluating '$("#form-group > tbody > tr")')
    (função anônima) (curriculo, line 865)
[Log] selected operator: iexact (advanced-filters.js, line 58)
[Error] Failed to load resource: the server responded with a status of 404 (Not Found) (http://127.0.0.1:8000/static/easy_select2/vendor/jquery/jquery.js, line 0)

Without Grappelli:
adv1

With Grappelli:
adv2

Good enough to me! Now... I'm late to make other changes in my system but I'll be back soon to try to help in developing the project.

Thanks! :D

from django-advanced-filters.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.