2008-8-12

22:43 JustinTArthur
'lo, msaelices.
22:43 rozwell
Killarny: just do it? Model(att1=foo, att2=bar)?
22:47 djkert
hello all, I am following along a flex example and they post application/xml to the server, is there a default way for django to handle this, I noticed it was the key in a 1 item dict but I thought maybe django had a different way to handle this???
22:47 Magus-
to handle what?
22:47 djkert
the xml
22:47 Magus-
its up to you to write views
22:47 Magus-
handle it how you please
22:47 djkert
parsing it or something
22:47 Magus-
django has nothing for handling xml, no
22:48 Magus-
there are plenty of python modules to do that, I'm sure
22:48 djkert
yeah, I just didn't like the idea of it being a key in a dict
22:48 djkert
I thought if you notified django it was xml it would do something different
23:05 FunkyBob
morning, all
23:05 neybar
I'm trying to use multiple formsets on the same page. How do I change the id of the formset?
23:05 wotaskd
Hey
23:05 keseldude
good morning to you
23:05 monotux
morning? it's 1 AM :(
23:05 FunkyBob
neybar: can't you pass an id prefix on instanciation?
23:05 FunkyBob
monotux: that's morning!
23:06 wotaskd
I've a quick question - I'm calculating the content of a slugfield using the save() function and it works pretty well... until I set the field as non-editable. Is ther any way to hide it from the admin app without triggering an exception?
23:06 wotaskd
this is what I'm doing http://dpaste.com/71065/
23:06 monotux
FunkyBob: heh :)
23:06 stp2007
monotux, if you have a chance and it's dark in your area go outside and see if you can see any of the meteor shower.
23:06 Magus-
wotaskd: that doesn't make sense that it'd throw an error
23:06 Magus-
that code looks fine
23:06 FunkyBob
wotaskd: what exception is it throwing?
23:07 FunkyBob
monotux: it's always morning somehwere...
23:07 monotux
stp2007: it's very cloudy right now :(
23:07 stp2007
:(
23:09 wotaskd
FunkyBob: I'll tell you in a sec... had to restart the server
23:11 wotaskd
FunkyBob: it gives me a KeyError (key 'slug' not found in 'Form')
23:12 phobik
how do I do this: def __str__(self):
23:12 phobik
return self.lname+fname
23:13 Magus-
put the self in front of fname also of course
23:13 wotaskd
FunkyBob: it actually points at an error at line 105 in django.forms.forms.py
23:16 sebastian
anyone know how can I print form errors that are not related to a field but raised in the def clean method?
23:16 sebastian
I know I can do from.fieldname.errors for field errors
23:17 sebastian
but I need to print global form errors
23:18 mattmcc
form.non_field_errors
23:21 greggg230
Anyone have recommendations for adding rich text editors to the admin?
23:23 dih0658
23:24 mcdiesel
Could someone show me how to validate that a file being uploaded is an mp3?
23:26 mcdiesel
or point me where I should look? haven't come up with much in searches
23:28 Magus-
you'd have to test request.FILES after upload finishes
23:29 keseldude
I think it's request.FILES.get('uploaded_mp3').get('content-type') == 'audio/mpeg'
23:29 keseldude
I could be wrong
23:29 rozwell
content-type can lie
23:29 Magus-
close, but no cigar
23:29 rozwell
see how ImageField does it
23:29 Magus-
1) entries in request.FILES are no longer dicts
23:29 keseldude
ah
23:30 Magus-
2) as rozwell noted, content-type isn't always accurate
23:30 Magus-
3) I'm not sure mp3 has a consistent mime type
23:30 mcdiesel
is it audio/mpeg?
23:30 Gulopine wishes he had his AudioFile done
23:30 Gulopine
er, AudioField
23:31 rozwell
i wish i had my videofield done
23:32 rozwell
but i'm not terribly keen on diving into libavcodec
23:33 Gulopine
23:33 rozwell
Gulopine: undoubtedly
23:34 rozwell
Gulopine: it seems all the ffmpeg python bindings projects out there have gone stale by years
23:35 RaceCondition
wow, I just realized that loaddata actually merges the existing dataset with the new one and doesn't overwrite the original one. nice :P
23:35 RaceCondition
I wish I had known that a long time ago
23:41 FunkyBob
hmm... is there a "proper" pattern for creating a child instance from a parent with model inheritance?
23:42 FunkyBob
so if I have class A and class B(A) .... how to create a B from an existing A
23:42 Magus-
you don't
23:42 FunkyBob
probably shouldn't bother with inheritance, I guess
23:42 Magus-
current weakness of inheritance
23:42 RaceCondition
inheritance is not dynamic
23:42 FunkyBob
ok... just checking
23:42 FunkyBob
couldn't see anything in the docs, so...
23:42 RaceCondition
which is exactly why you can't do that
23:43 NoahJ
Magus, I am trying to install that registration thing and I get an error "no such table: registration_registrationprofile"
23:43 Magus-
personally, I don't see any reason to block it
23:43 RaceCondition
depends on the inheritance type used though
23:43 Magus-
NoahJ: so you added it to INSTALLED_APPS and ran syncdb?
23:43 RaceCondition
haven't really delved into Django's model inheritance
23:43 Magus-
placed it directly on pythonpath (i.e. by using setup.py install), and not inside your project?
23:43 NoahJ
oh I didn't remember to sync
23:44 FunkyBob
it's ok.. we were just using inheritance as a slack-ish way to avoid digging deeper into serialising )
23:44 FunkyBob
:)
23:45 NoahJ
still getting the error
23:46 keseldude
NoahJ: python manage.py reset registration
23:46 keseldude
or something along those lines
23:46 Magus-
NoahJ: are you using sqlite?
23:47 NoahJ
yeh
23:47 Magus-
did you use a relative path in DATABASE_NAME ?
23:48 NoahJ
no
23:48 Magus-
ok, good
23:48 NoahJ
sqlite3 and full path
23:48 Magus-
so you added 'registration' in INSTALLED_APPS ?
23:48 NoahJ
I wish I could just use the form they made without having to redirect all the urls
23:49 Magus-
well its not much good without the rest of it, NoahJ
23:49 NoahJ
I just wanted to replace the UserCreationForm
23:49 NoahJ
because it wasn't working anymore
23:50 NoahJ
I replaced it with the RegistrationForm class and took out the wrapper so the form was just passed as is to the template
23:51 Magus-
uh
23:51 Magus-
you can't do that
23:51 Magus-
if you don't want to use all of registration, don't use any of it
23:51 Magus-
just use UserCreationForm and fix your view code
Page 35 of 36   ← Previous  Next →(3,523 total)