Giter Site home page Giter Site logo

Comments (13)

jpic avatar jpic commented on May 21, 2024

Fixed in 3a2d6d3

You may now see Django-1.4 is required in both the README and documentation.

Thank you for your feedback !

from django-autocomplete-light.

jpic avatar jpic commented on May 21, 2024

I'm not sure, do you think that Django-1.4 should be a requirement for the whole app or just for that ? Did you get the rest to work ?

from django-autocomplete-light.

xrmx avatar xrmx commented on May 21, 2024

I meant only for the specific example, triying to use change the widget of the field in the ModelForm by hand but it dies here:

In template /venv/src/django-autocomplete-light/autocomplete_light/templates/autocomplete_light/widget.html, error at line 17
Caught FieldError while rendering: Cannot resolve keyword 'name' into field. Choices are: agent, data_creazione, data_modifica, id, ip, miao, qualcosa, u_data_pubblicazione, u_stato_pubblicazione

from django-autocomplete-light.

jpic avatar jpic commented on May 21, 2024

You have two options:

  • override YourChannel.search_field, which is used by the default (trivial) query_filter() implementation
  • override YourChannel.query_filter(), that's probably what you want

Thanks for your feedback, i'm about to document this.

from django-autocomplete-light.

jpic avatar jpic commented on May 21, 2024

Here is the documentation: http://django-autocomplete-light.readthedocs.org/en/latest/quick.html#quick-admin-integration

Hope this helps ! Does it ?

from django-autocomplete-light.

xrmx avatar xrmx commented on May 21, 2024

Yes, very helpful thanks. Now another missing bit is that django.contrib.staticfiles is required in INSTALLED_APPS and that you should run manage.py collectstatic.

from django-autocomplete-light.

jpic avatar jpic commented on May 21, 2024

Thank you for your feedback, a note about django.contrib.staticfiles was added to http://django-autocomplete-light.readthedocs.org/en/latest/quick.html#quick-install

Does it match your expectations ?

from django-autocomplete-light.

xrmx avatar xrmx commented on May 21, 2024

Yes, thanks

from django-autocomplete-light.

jpic avatar jpic commented on May 21, 2024

Great, i'll close this issue for now but feel free to re-open or open another one.

from django-autocomplete-light.

jpic avatar jpic commented on May 21, 2024

BTW, did you find a solution for modelform_factory ?

from django-autocomplete-light.

xrmx avatar xrmx commented on May 21, 2024

Yes, the solution is not use modelform_factory :) i've definied the widget for the field as usual:

class PositionForm(forms.ModelForm):
    class Meta:
        model = Position
        widgets = {
            'city': autocomplete_light.AutocompleteWidget('CityChannel', max_items=1)
        }

from django-autocomplete-light.

jpic avatar jpic commented on May 21, 2024

Thanks for your feedback, I knew you had come up with something hehe... Maybe this would work too:

class Meta:
    model = Position
    widgets = autocomplete_light.get_widgets_dict(Position)

get_widgets_dict: http://django-autocomplete-light.readthedocs.org/en/latest/forms.html#autocomplete_light.forms.get_widgets_dict
Not sure if it's worth trying and / or documenting, probably users who actually need it (ie. model with lots of FKs/M2Ms) will figure it out by themselves

from django-autocomplete-light.

xrmx avatar xrmx commented on May 21, 2024

I prefer the explicit version but may be helpful to other people.

from django-autocomplete-light.

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.