joshuajoshua: ok, i'll see if i can reproduce it. i disabled the middleware and it still had me logged in so it showed the admin root. i reenabled the middleware and it still let me see the admin root? so i'm not sure what the difference is unless it was something weird with an old session.
joshuajoshua
yeah, before adding something like this, you'll want to trash the sessions db
rogi has quit
kristallpirat has quit
rogi joined the channel
bullicon has quit
lcastro joined the channel
home has quit
tmitchell has quit
recur joined the channel
munga has quit
JJMalina joined the channel
seagreen
How should I be using forms in django? So far I've just been building them in the templates and handling them in views. Should I start using the form class or is it OK to get along without it? It hasn't been necessary so far.
munichlinux joined the channel
joshuajoshua
seagreen, wow, that's definitely the hard way.
alexkane joined the channel
Ideally a form is built from a subset of fields on a model and the template is built automatically. Using model froms even take care of the cleaning and saving.
vakaras joined the channel
seagreen
OK, so I should actually learn to use form classes:)
joshuajoshua
Yes, that like the first thing you should have learned when you started using django
seagreen
Hahaha. What can I say? It works fine without them.
exit2
anyone here tried to make a tic tac toe game in Django?
joshuajoshua
Forms are VERY powerful and require zero work when you use the ModelForm functionality.
exit2, It's a web framework, how is tic tac toe relevant?
LiNT has quit
estulticia has quit
alexkane
I have a ModelForm with a ManyToMany field. I need to override the ManyToMany widget and make it use a ChoiceField. I also need to set the choices of the field dynamically. I'm trying to set the choices using this queryset, but I get no choices in the drop down:
joshuajoshua: yeah maybe I should just do it all in JS instead of Python
joshuajoshua
alexkane, Why not override the entire field to a choicefield? No widget swapping required. You can then set the queryset in the __init__ method of the form.
a choicefield and a ModelChoiceField are two differnt types ;)
nickmeharry joined the channel
alexkane
hmm...
joshuajoshua
A modelchoicefield has a queryset parameter, a choicefield doesn't
Furao__ joined the channel
alexkane
queryset param
right
looking at the docs now
LiNT joined the channel
rogi has quit
Furao has quit
twikz has quit
Furao joined the channel
joshuajoshua
just change your code to rooms = forms.ModelChoiceField(label='Room', queryset=Room.objects.none()) then define the queryset in init
rogi joined the channel
robmorrissey has quit
alexkane
awesome, thanks
joshuajoshua
no prob
rasca has quit
d0c0nnor has quit
munichlinux has quit
Furao has quit
Furao__ has quit
jj0hns0n has quit
atula joined the channel
hwrd|work joined the channel
picoguy has quit
munga joined the channel
hwrd|work has quit
_Vlad_ has quit
hwrd|work joined the channel
natea has quit
jdunck joined the channel
nickmeharry has quit
chutwig has quit
jcarbaugh has quit
estultic1a joined the channel
picoguy joined the channel
alexkane
joshuajoshua: I think I need to do something like this, but it's throwing an exception complaining about self not being defined http://pastebin.com/QMPax7mw
jcarbaugh joined the channel
frequant has quit
nickmeharry joined the channel
md4d has quit
joshuajoshua
alexkane, Where is self.room_queryset coming from?