First time here? Check out the FAQ!
0

Updating settings

Hello,

If I want to change the value of a field already stored in the database, I get an error for duplicate key. I think it tries to insert the value instead of updating it if it is already in the database.

What can I do ?

AlexP's avatar
23
AlexP
asked 2011-09-11 09:03:35 -0600
edit flag offensive 0 remove flag close merge delete

Comments

add a comment see more comments

3 Answers

0

What are the settings we can update using settings.update?

Can we enable/disable local login with this? If so, what is the parameter to be used?

kishan's avatar
11
kishan
answered 2018-01-31 21:24:21 -0600
edit flag offensive 0 remove flag delete link

Comments

add a comment see more comments
0

I update them from MySQL command prompt.

But I was talking about updating the settings from the settings panel.

AlexP's avatar
23
AlexP
answered 2011-09-11 09:26:50 -0600
edit flag offensive 0 remove flag delete link

Comments

Next time try the python shell method, it may be just easier. "python manage.py shell" then type python commands. In the case with MySQL you just must have typed a wrong command.

Evgeny's avatar Evgeny (2011-09-11 09:29:57 -0600) edit

I would definitely not recommend updating settings directly through sql, as well as most other things. If you find yourself frequently needing to update something - please let us know, we could maybe write a management command or something like that.

Evgeny's avatar Evgeny (2011-09-11 09:31:37 -0600) edit
1

I don't really need a command to manage the settings, but when using the web Interface, I get this error :

IntegrityError at /settings/LOGIN_PROVIDERS/
(1062, "Duplicate entry '1-LOGIN_PROVIDERS-SIGNIN_IDENTI.CA_ENABLED' for key 2")

If I update an existing value.

AlexP's avatar AlexP (2011-09-11 09:40:10 -0600) edit

That's useful to know. I've tested this on my development environment that runs on sqlite and the production server - on mysql. In both cases works. Have you customized your setup in any way or you are running askbot "out of the box"?

Evgeny's avatar Evgeny (2011-09-11 09:42:20 -0600) edit

No, it's a standard installation (just updated to version 0.7.22 today). The only changes I made are on the template.

AlexP's avatar AlexP (2011-09-11 09:46:07 -0600) edit
add a comment see more comments
0

It depends on how you are updating the settings - did you write code to do that or typed into django's python shell?

If you want to programmatically update settings, then the way to do it is:

from askbot.conf import settings
settings.update('SETTING_NAME', setting_value)
Evgeny's avatar
13.2k
Evgeny
answered 2011-09-11 09:15:52 -0600
edit flag offensive 0 remove flag delete link

Comments

add a comment see more comments