-
Notifications
You must be signed in to change notification settings - Fork 468
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Is there a way to add a "loading" gif to the input? #244
Comments
That's a great idea. What gif should we use ? Something from ajaxload.info ? |
Yes, that sort of thing! I think there are plenty of them (free, I hope...) on the web to use. |
You can use $.ajaxStart(), but it would nice to provide that feature out of the box BTW, it's a really good idea. We could trigger an event in Autocomplete.makeXhr() and another one in Autocomplete.fetchComplete. That might be overkill, we could just add a class |
Released in 2.0.0a13, thanks for your feedback ! |
Wow, immediate answer!! Thank you! 👍 |
Try 2.0.0a14 BTW, 2.0.0a13 misses the default images. On Tue, Jan 28, 2014 at 10:39 AM, yliharma [email protected] wrote:
http://yourlabs.org http://blog.yourlabs.org |
Yes I saw that and installed the git repo using |
How do you like it ? Does it work for you ? |
It works, it's exactly what I needed! |
I did try to make it a bit more consistent with other fields. Could you open the autocomplete url directly and check the HTML and ensure that choice template isn't used ? Could you paste your autocomplete_light_registry.py ? |
Sorry, the template works, it was my fault...those admin pages are all the same and I was looking to a non generic autocomplete 😄 |
Yep me too. Maybe we could offer several styles and let the user activate On Tue, Jan 28, 2014 at 12:43 PM, yliharma [email protected] wrote:
http://yourlabs.org http://blog.yourlabs.org |
Isn't that already possible specifying the attrs attribute for the widget? Django provides a way to do things like that: |
Yes my bad, we call it attrs as well now. I don't recommend that you However, doing as stated in the faq was broken and I just fixed it xD |
If you upgrade to 2.0.0a15, you can use the modern style again. For example:
Don't forget to replace autocomplete_light.SomeWidget by the right widget (probably either ChoiceWidget or MultipleChoiceWidget). Note that there is attrs to set input attributes, and widget_attrs to set attributes on the widget container (a span.autocomplete-light-widget by default). NOT the same ;) |
Something breaks if I add the widget definition |
Ok, paste the full form definition when you can ! On Tue, Jan 28, 2014 at 6:04 PM, yliharma [email protected] wrote:
http://yourlabs.org http://blog.yourlabs.org |
Could you switch to copy/paste mode and paste the full traceback please ? I can't see what function caused this ;D Also, are you sure that you're using the latest version of django-autocomplete-light ? Also, did you check that model with ContentType 42 and PK 2152 exists in the database ? |
I tried executing again:
and obtained:
Yes the instance of model with ContentType 47 exists (after all it was autocomplete_light which retrieved it from the database...) |
This means you're not on v2. You should try to uninstall and re-install again. If you want to install from the git repo in development mode then:
Note the difference: Then, to update:
I have tested everything I could think of in today's commits and couldn't reproduce the problem, maybe using the right autocomplete-light version will help ? |
Same error, same traceback....
|
It doesn't seem to be able to split the string containing content type id and object id. |
Could you paste models and autocomplete_light_registry please ? |
class FilmAutocomplete(autocomplete_light.AutocompleteModelBase):
search_fields = ['^name', '^original']
order_by = ['name']
choice_html_format = u'''
<span class="block" data-value="%s">%s <a href="%s" target="_blank" class="choice-detail">→</a></span>
'''
def choice_html(self, choice):
return self.choice_html_format % (self.choice_value(choice), self.choice_label(choice.get_full_name()),
choice.get_absolute_url())
autocomplete_light.register(models.Film, FilmAutocomplete) This is the inline model for the form I posted above: class BoxofficeFilm(models.Model):
boxoffice = models.ForeignKey(Boxoffice)
film = models.ForeignKey(Film)
weekend = models.BigIntegerField("incasso")
theaters = models.IntegerField("sale", blank=True, null=True)
average = models.IntegerField("media", blank=True, null=True)
total = models.BigIntegerField("totale", blank=True, null=True)
status = models.SmallIntegerField("tendenza", blank=True, null=True,
choices=BOXOFFICE_STATUS_CHOICES) The Film and Boxoffice models are too big to post 😄 |
I see, you have not specified the autocomplete name, it should be:
It's using a generic autocomplete by default. I might find a way to fix that but that's not garanteed. |
I did mislead you, sorry ! |
😄 No problem, it happens! Thank you, now it works as expected! |
It would be useful to show a "loading" gif to the user into the input text while he's searching, otherwise it seems the request didn't find anything even if it's still running...
Sorry if this already exists but I couldn't find it (I'm using version 2).
The text was updated successfully, but these errors were encountered: