hi guys, i'm trying to find a way to filter the values of one foreign key field by another foreign key field in a django admin form.
naro joined the channel
am i on the right track by using SimpleListFilter ?
Hairy joined the channel
gopar has quit
FunkyBob
I'm not sure anyone understands what you mean, lucidm
lucidm
hm, ok. So say I'm adding a new entry for a model: episode. it has two foreign key fields; Season and Show.
Shariq has quit
FunkyBob
so.. you're trying to do a cascading select?
lucidm
after selecting the show, only the relevant seasons should be listed
FunkyBob
where selecting in one field limits choices in the next?
lucidm
yes, that's it
rgenito__ has quit
FunkyBob
in that case, no.. SimpleListFilter is the wrong device
decko joined the channel
the fact you _can_ select the wrong season for a show indicates your schema is flawed
Guddu_ joined the channel
Hairy joined the channel
lucidm
ok, that's true
EyePulp joined the channel
normally I would only have the 'season' be a foreign key, which in turn has the 'show' as one. I guess I got carried away making the admin forms.
FunkyBob
you shouldn't be putting this much work into admin
basti-mbp joined the channel
it should be going into your sites management interface
Guddu has quit
chemich joined the channel
Guddu__ joined the channel
underthehill joined the channel
EyePulp has quit
limbera joined the channel
limbera
having quite a noob moment
FunkyBob
when aren't you? :P
limbera
my static css files are being correctly accessd in my templates
but my images aren't
FunkyBob
media?
limbera
feel the burn eh FunkyBob P
:P
FunkyBob
or static?
limbera
there you go!
haha
well i assumed that images were considered static?
(it's not user submitted content)
basti-mbp has quit
oh gosh i worked it out ..
MarkusH
limbera: then it's static
limbera
base.html had no {% static '' %}
declarations
MarkusH
is it part of your deployment -> static
limbera
i was looking through my homepage.html template
which extends base
Guddu_ has quit
and i forgot to swap all the base elements from hardcoded elements (when i was designing the HTML) to proper static django ones
dray3 has quit
the ultimate N00b moment
MarkusH
FunkyBob: will you be at PyCon AU?
FunkyBob
MarkusH: I certainly hope so!
MarkusH
:)
bnmalcabis has quit
FunkyBob
you? :)
Hairy joined the channel
MarkusH
of course
FunkyBob
do you have acoom etc sorted yet?
GabLeRoux joined the channel
halfnibble joined the channel
only, since i'm planning to travel sans family, we could split an appartment perhaps?
mission has quit
Hairy joined the channel
halfnibble
Question. Can someone point me to a document, or explain why Django Form Wizard (http://bit.ly/1BWKPg4) uses "<table></table>" in all the template examples?
FunkyBob
halfnibble: because {{ form }} defaults to {{ form.as_table }}
lucidm has quit
halfnibble
@FunkyBob Are you serious? I've been writing CBV's and templates and have never needed to use "<table></table>" before. Does forms.ModelForm with a CBV default to something else?
FunkyBob
halfnibble: you never need to use table... you never need to use the html rendering aspect of forms at all...
darkpixel
Why or why does Django swallow template errors from an include? {% include "blah.html" %}
*Why oh why?
FunkyBob
darkpixel: it shouldn't
darkpixel
Hrm. That's not encouraging. ;)
FunkyBob
halfnibble: CBV have fuck all influence over your template/form rendering
darkpixel
That means I've done something wrong on the last four projects I've pushed out.
FunkyBob
darkpixel: what makes you think it is?
halfnibble
@FunkyBob Fascinating. Thanks. This is what I needed to know. The documentation just threw me off a bit.
FunkyBob
halfnibble: this is irc, not twitter... no @ here
WLL joined the channel
halfnibble
Sorry. I'm a bit new to IRC.
FunkyBob
well, now you know.
halfnibble
Thanks again. :)
MarkusH
FunkyBob: no, I haven't figured out the accommodation yet.
Hairy joined the channel
ustunozgur joined the channel
underthehill has quit
rougeth has quit
darkpixel
FunkyBob: I have a 'person' table that I {% include %} all over the place. I accidentally fat-fingered {% end for %} (yeah, with the space) inside the person table. Every page rendered perfectly, except the person table wasn't included. It's like the include errored out because of the typo, and Django included "" where the table should have been.
FunkyBob
darkpixel: which django version?
`nik`
how do i access django.contrib.auth.model.User in a data migration?
FunkyBob
`nik`: same way you access any model?
darkpixel
FunkyBob: 1.7.4, although I hear 1.7.5 came out this morning.
FunkyBob
so that means you're using my version of the include tag
darkpixel
Hmm...maybe I should do a 'git blame' before ranting. ;)
`nik`
FunkyBob: alright. i was just asking because internal models are accessed like: Item = apps.get_model("main", "Item")
underthehill joined the channel
FunkyBob
`nik`: all models are accessed that way, aren't they?
`nik`
which is how i thought u normally accessed models from a data migration
FunkyBob
darkpixel: haha
darkpixel: nah... rant on... just means I know more about how to fix it
`nik`
so for User i would do.. apps.get_model('django.contrib.auth.models', 'User')?
FunkyBob
no
get_model('auth', 'User')
app_label works the same for contrib as any other apps
`nik`
okay.. i guess i don't understand that, but thanks
FunkyBob
don't understand app_label ?
`nik`
yeah
FunkyBob
basically it's the name of the module, by default... so for "django.contrib.auth' it's "auth"
Hairy joined the channel
`nik`
interesting.. i didn't know there were shortcuts like that. i'll look into app_label
FunkyBob
if you app was 'foo.bar.baz' its default label would be 'baz'
darkpixel
FunkyBob: Hmm...looking at the source, it looks like IncludeNode swallows errors unless 'context.template.engine.debug' is True.... is that frobbed by DEBUG = True in settings.py?
FunkyBob
darkpixel: engne? you sure you're using 1.7? that sounds like 1.7
1.8
darkpixel
Oops--I'm running 1.7.4, but looking at HEAD.
FunkyBob slaps darkpixel with some wilted celery
FunkyBob: LOL! So it looks like I need to explicitly set TEMPLATE_DEBUG = True in 1.7.4
jakul joined the channel
FunkyBob: Yup--that's it.
mattmcc
Incidentally, that setting's going away in 1.8.
MarkusH
actually, for the user model you want django.contrib.auth.get_user_model, `nik`
FunkyBob
MarkusH: that's if you want the user model... nik asked for auth.User specifically
MarkusH
well, if it's swapped out you can't use auth.User anyway
Hairy joined the channel
ah, missed the beginning
yes, in a data migration it's apps.get_model
kmtsol has quit
gopar joined the channel
jakesyl joined the channel
jakesyl
Hey so I'm using django EmailMessage(subject, body, from_email, to_mail, headers=headers) and then adding these headers headers = { "From" : from_email, "Reply-To:" : from_email, "Content-Type:" : "text/html", "charset" : "UTF-8"} and getting this raw text https://gist.github.com/jakesyl/94e78e5005436b0...
also the email is showing <b> instead of formatting it