Koterpillar: Hmm... I'll try that, but right now, the issue is that the index page works but the entries don't (they seem to redirect to the main page)
retailify has quit
Koterpillar
dioo: paste what you have now, preferably without the +/- at line start
dioo
Wait, the only issue is that I'm using a tuple instead of a list?
Koterpillar
dioo: and app_name
dioo
Ohh, I missed that, thanks
Koterpillar
dioo: I think the tuple will work but don't rely on that
I'm going to end up with 50ish models inheriting from the abstract base class
after digging into the docs I assume the best way to relate prices to parts is a genericforeignkey?
FunkyBob
sounds like questionable modelling
lolidunno
I also considered storing attributes in a jsonfield
and just having one generic parts model
dhmspector joined the channel
fission6 joined the channel
node77
I have used User (form django.contrib.auth.models) and extended to other model name UserAnswer in models.py. UserAnswer is linked to User by OneToOne relationship. But , when I try to save fields in UserAnswer after a user is logged it, the code shows this error "column user_id is not unique". Where am i going wrong?
fission6 has quit
Koterpillar
node77: can one User have multiple UserAnswers?
node77
Koterpillar: No
mitvok has quit
Koterpillar
show the code
FunkyBob
it really sounds like you're saving a second answer for a Uer
Fanthomas90 joined the channel
Fanthomas90_ has quit
mitvok joined the channel
fission6 joined the channel
node77
koterpillar: views.py-"""def instruction(request, pick): if request.user.is_authenticated() and request.user.is_active: question = Question.objects.filter(stream__sub_title=pick) user1=User.objects.get(username=request.user.username) stream1=Stream.objects.get(sub_title=pick) user_ans=UserAnswer(user=user1, ans_stream=stream1) user_ans.save()"""
bsl10 has quit
Koterpillar
node77: what FunkyBob said
FunkyBob
node77: use dpaste.de to share code
node77: can a User have only one UserAnswer? or only one UserAnswer _per_ Question ?
NomadJim has quit
Azendale has left the channel
bsl10 joined the channel
node77
FunkyBob: Yes, I am saving UserAnswer just first time
aditi_gupta has quit
FunkyBob
that doesn't answer my question at all
mitvok has quit
NomadJim joined the channel
Koterpillar
node77: look at the database, there might already be answers
mehola joined the channel
josuebrunel joined the channel
DLSteve has quit
mandeep has quit
bsl10 has quit
FunkyBob
node77: can a User have only one UserAnswer? or only one UserAnswer _per_ Question ?
ursan has quit
bsl10 joined the channel
pembo13_ joined the channel
bsl10 has quit
bsl10 joined the channel
converse joined the channel
node77
FunkyBob Koterpillar: https://dpaste.de/T9n6 ....one user has one UserAnswer, Question models are not related to UserAnswer. The answer are stored per user ans stored in form of string
bsl10 has quit
Koterpillar
node77: look at your database now
node77: if there is already a UserAnswer for that user, you will try to create a second one
bsl10 joined the channel
mkoistinen has quit
treyhunner has quit
FunkyBob
so no matter how many questions or streams there are... a User can only ever have a single UserAnswer ... ever
bsl10 has quit
seems odd
treyhunner joined the channel
mattmcc
And its PK is always 42.
FunkyBob
:P
bsl10 joined the channel
holler has quit
node77
FunkyBob: I am trying to store all useranswer in string form (which is basically a dictionary) in one field
holler joined the channel
lolidunno
hmm
node77
Koterpillar: But I have not created UserAnswer anytime before in my code. And I just want to use the reference of User to store answers
Koterpillar
node77: have you accessed that page before?
ursan joined the channel
lolidunno
entering json in the admin panel is a lot more free form which may or may not be a good thing since not all specs are always available to me
dhmspector has quit
Koterpillar
node77: if you really want to ensure one useranswer, why not use user.useranswer?