0

I have a strange problem.

I don't know how I should even start doing it, my written english is really bad, so I can't really google it, because it seems complicated.

I'm doing a simple database web application using Django 1.7.1, I want to use autocomplete_light for autocompletion of some fields.

I'm using SQLite Database, in DB I have some "dictionary" tables, it means that user is likely to use some names multiple times in other records, so in "master" table, I store just id of that name. Is there any way of making such ChoiceFields and MultipleChoiceFields (for "reversed" situation), that if user will write new value (not stored in "dictionary" yet) in it, it will be automatically added to "dictionary" table?

I would be really thankful for any advices, or even suggestions where should I search such thing.

Vabi
  • 5
  • 2
  • so you want that the autocomplete should show the existing fields but if there is a new field then it should automatically add it, correct? – abhishekgarg Dec 20 '14 at 20:25
  • Correct, automagically add it to database (which will require editing autocomplete code i suppose), or simply to allow entering such values and add it when user sends whole form, which I found more natural, but still i have no idea how should I even start, what to google, and what to read. – Vabi Dec 20 '14 at 20:27
  • I have not used autocomplete_light, but what you can do is something like sending an ajax request on blur event of that field and add that entry if it doesn't exists in database.(assuming that there is one specific entry) – abhishekgarg Dec 20 '14 at 20:31
  • I'd rather want to force multiple choice field and choice field to pass new values, and deal with it through validation, or something similiar, is there any way to do it? – Vabi Dec 21 '14 at 09:01

1 Answers1

0

I did it as simple add another like in administration panel: http://django-autocomplete-light.readthedocs.org/en/stable-2.x.x/addanother.html

Vabi
  • 5
  • 2