0:00 AM
Sir_Narwhal has quit
0:01 AM
necrite has quit
0:01 AM
mfcovington has quit
0:02 AM
nicktgr15
SmileyChris: hmmm…yeah….. whatever :D
0:04 AM
Itkovian has quit
0:07 AM
SmileyChris: "If that doesn’t exist, or is empty, Django tries the URL in the Referrer header. " I think that's the case.. because the "next" parameter is empty and the Referrer header points to the source language not the destination… :S
0:08 AM
mfcovington joined the channel
0:08 AM
acangiani has quit
0:10 AM
crakrjak has quit
0:10 AM
acmehandle
Do I override get_objects in a CreateView CBV if I want to filter the results in a form that is being rendered
0:10 AM
crakrjak joined the channel
0:10 AM
jazzzu has quit
0:10 AM
mfcovington has quit
0:11 AM
FunkyBob
acmehandle: erm.... filter which results?
0:12 AM
acmehandle
Give me a moment, I need to think this through.
0:13 AM
hubx has quit
0:14 AM
ModelForm > Template. So the results of the model associated to the ModelForm. Or in other words, one of the fields of the model is a ForeignKey, hence the form being rendered has a MultipleChoice drop down menu that is rendered along with the other fields which I defined.
0:14 AM
I hope that makes sense.
0:14 AM
bee_keeper has quit
0:15 AM
So I want those results that show up in the drop down field to be the ones only associated with the model associated via the ForeignKey
0:15 AM
Whereas right now object is showing up in the dropdown field.
0:15 AM
csotelo has quit
0:16 AM
FunkyBob
if it's a FKey, it can't be a multiple-choice
0:16 AM
so, you want to filter the choices for a fkey field?
0:16 AM
crakrjak has quit
0:16 AM
or is this a list of a model related to this one?
0:17 AM
acmehandle
0:17 AM
But yes, I want to filter the choices for the fkey field
0:20 AM
I have to take a step back. I need to filter based on user, but the user_id field is in the foreign model.
0:21 AM
So I need to reach in to the other model to filter the results for this model
0:26 AM
FunkyBob
so in your Form.__init__ you need to update the field queryset according to the user?
0:27 AM
so for a CBV you'd need to (a) provide your custom form class, and (b) update get_form_kwargs to include request.user
0:27 AM
then update your form class to accept user, and self.fields['whatever'].queryset = user.foo_set.all()
0:27 AM
mazatta joined the channel
0:27 AM
mazatta has quit
0:33 AM
aul joined the channel
0:34 AM
gopar has quit
0:34 AM
acangiani joined the channel
0:35 AM
acmehandle
FunkyBob, update the form class in views.py or in forms.py?
0:36 AM
amikiri joined the channel
0:36 AM
crakrjak joined the channel
0:36 AM
In ModelForm. But I guess 'update' is a word you can use to describe what I need to do. But yes, according to the user.
0:37 AM
But giving it more thought, yes. I think you have it.
0:37 AM
FunkyBob
you need to alter the form class and the view
0:37 AM
acmehandle
I need to update, filter the queryset according to the user.
0:38 AM
FunkyBob
yes
0:38 AM
and you do that in your Modelform's __init__ method
0:41 AM
xupisco has quit
0:41 AM
acmehandle
but get_form_kwargs returns the fields going to the form for rendering in {{ form }}
0:41 AM
?
0:42 AM
bed777 joined the channel
0:42 AM
bed777
hi hi
0:42 AM
FunkyBob
no, it returns the kwards you're passing to the form class when you isntanciate it
0:42 AM
bed777
FunlyBob, hi – can you please re-link your blog post about custom user model?
0:43 AM
FunkyBob*
0:43 AM
FunkyBob
and this is why I think CBGV are hazardous to new djangonauts
0:43 AM
bed777: sure
0:43 AM
though it was mroe about registration
0:43 AM
0:43 AM
bed777
10x man
0:45 AM
Sir_Narwhal joined the channel
0:45 AM
mazatta joined the channel
0:45 AM
mazatta has quit
0:46 AM
mazatta joined the channel
0:46 AM
mazatta has quit
0:49 AM
exaroth joined the channel
0:49 AM
acmehandle
Always appreciate that vote of confidence
0:50 AM
x100s has quit
0:51 AM
crakrjak has quit
0:52 AM
sef joined the channel
0:53 AM
masterphi has quit
0:53 AM
bed777
IntegrityError: NOT NULL constraint failed: users_user.first_name
0:53 AM
first_name = models.CharField(max_length=32, null=True, blank=True)
0:53 AM
what?
0:53 AM
exaroth has quit
0:53 AM
FunkyBob, ideas?
0:55 AM
keimlink_ joined the channel
0:57 AM
FunkyBob
bed777: did you add null=True after your initial syncdb, and forget to create/apple a migration/
0:57 AM
why the fuck do you have a nullable char field?
0:57 AM
Dslegends joined the channel
0:57 AM
necrite joined the channel
0:58 AM
keimlink has quit
0:58 AM
bogeyd6 has quit
0:58 AM
bed777
why not?
0:58 AM
first_name its optional..
0:59 AM
yes I forgot to migrate
0:59 AM
apply, I mean
0:59 AM
keimlink_ has quit
0:59 AM
mazatta joined the channel
0:59 AM
mazatta has quit
1:01 AM
mfcovington joined the channel
1:01 AM
kriwil joined the channel
1:01 AM
necrite has quit
1:04 AM
bed777 has quit
1:05 AM
hawkowl_work has left the channel
1:07 AM
ciurkut has quit
1:08 AM
bspkrs is now known as bspkrs|out
1:15 AM
mfcovington has quit
1:19 AM
tubaman has quit
1:20 AM
Dopagod has quit
1:22 AM
snurfery joined the channel
1:25 AM
tubaman joined the channel
1:26 AM
rkjdid has quit
1:27 AM
Diegao joined the channel
1:28 AM
snkcld joined the channel
1:29 AM
StvnW joined the channel
1:29 AM
crakrjak joined the channel
1:31 AM
nicktgr15 has left the channel
1:32 AM
mribeirodantas has quit
1:34 AM
k_sze[work] joined the channel
1:35 AM
acmehandle
MRO in django is the same as MRO in the rest of python right?
1:36 AM
eka has quit
1:36 AM
bed777 joined the channel
1:36 AM
bed777
ValueError: Cannot find a UNIQUE constraint on table users_user, columns ['username']
1:36 AM
FunkyBob, ideas?
1:36 AM
necrite joined the channel
1:37 AM
hackedhead has left the channel
1:37 AM
kriwil has quit
1:39 AM
this is south
1:39 AM
shit
1:40 AM
snkcld has quit
1:40 AM
snurfery has quit
1:43 AM
Balthek has quit
1:43 AM
crakrjak has quit
1:43 AM
crakrjak joined the channel
1:46 AM
eka joined the channel
1:50 AM
necrite has quit
1:51 AM
crakrjak has quit
1:53 AM
MarkusH
acmehandle: not sure I understood you correctly, but 'course it is. Django doesn't have a custom MRO
1:54 AM
after all it is "just Python"
1:56 AM
nimomo joined the channel
1:56 AM
bed777 has quit
2:00 AM
mazatta joined the channel
2:01 AM
nimomo has quit
2:01 AM
autrilla_ joined the channel
2:03 AM
snkcld joined the channel
2:04 AM
diegoguimaraes joined the channel
2:04 AM
mazatta has quit
2:05 AM
autrilla__ has quit
2:06 AM
acangiani has quit
2:07 AM
Diegao has quit
2:16 AM
bspkrs|out is now known as bspkrs
2:19 AM
saint-ron joined the channel
2:23 AM
Swambo has quit
2:24 AM
maZtah has quit
2:25 AM
robbyoconnor has quit
2:25 AM
saint-ron has quit
2:25 AM
robbyoconnor joined the channel
2:25 AM
acangiani joined the channel
2:26 AM
saint-ron joined the channel