LingL icon indicating copy to clipboard operation
LingL copied to clipboard

Fresh install, created new language (spanish) but can't edit it.

Open jzohrab opened this issue 2 years ago • 4 comments

Clicking on the link to edit the language (http://127.0.0.1:8000/language_detail/?edit=14) gave the following message:

>list index out of range

Request Method: | GET
-- | --
http://127.0.0.1:8000/language_detail/?edit=14
3.2.4
IndexError
list index out of range
/Users/jeff/Documents/Languages/LingL/.venv/lib/python3.9/site-packages/django/db/models/query.py, line 318, in __getitem__
/Users/jeff/Documents/Languages/LingL/.venv/bin/python
3.9.13
['/Users/jeff/Documents/Languages/LingL',  '/Library/Frameworks/Python.framework/Versions/3.9/lib/python39.zip',  '/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9',  '/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/lib-dynload',  '/Users/jeff/Documents/Languages/LingL/.venv/lib/python3.9/site-packages']
Wed, 26 Oct 2022 06:39:01 +0000

full paste is on pastebin

Thanks!

This is interesting because on the home page, there is a dropdown listing all the languages I have (spanish and german), and the spanish element does have an ID of 14.

jzohrab avatar Oct 26 '22 06:10 jzohrab

Investigating further. models.py has the following:

    # for the chosen lang (language I want to learn)
    # the ADMIN has the basic languages (owner=1)
    if not called_by_Obj:
        learning_lang = Languages.objects.filter(owner=1, code_639_1=code_learninglang_OR_obj).values()[0]
        googletranslate_dicturi = learning_lang['googletranslateuri']

but I created the language Spanish under my account (the non-admin account), so the owner_id of the language spanish is 2:

sqlite> select id, name, owner_id from languages where id=14;
id|name|owner_id
14|Spanish|2

I guess the language has to be created by the admin (??), instead of by individual users. I'll update that record manually and try editing it again.

jzohrab avatar Oct 26 '22 15:10 jzohrab

Hi JZ, I'm having the same problem, where I can't edit a language that I added manually. How did you solve it in the end?

lisavader avatar Mar 24 '23 16:03 lisavader

I ran into further problems, and seeing as the project appeared to be dead, I wrote a new one called Lute :-)

https://github.com/jzohrab/lute

jzohrab avatar Mar 24 '23 17:03 jzohrab

Ah cool, thanks for letting me know! I'll check out your project :)

lisavader avatar Mar 25 '23 11:03 lisavader