2008-3-11

23:13 Spads
brosner: heh, oddly enough many of those are about the guitarist :)
23:13 Magus-
mysite.urls = mysite/urls.py, of course
23:13 Magus-
just like mysite.settings = mysite/settings.py
23:13 Magus-
standard python module referencing
23:13 flaco
thks
23:16 Leonidas
how can I exclude a specific object from a queryset?
23:16 Magus-
.exclude() of course
23:17 Leonidas
Magus-: I tried that, but the resulting queryset was broken
23:17 EyePulp_
of course.
23:17 EyePulp_
(not of course?)
23:17 Magus-
Leonidas: then you did it wrong
23:17 Magus-
pastebin some code :)
23:17 Leonidas
Magus-: yeah, I suppose so, moment
23:17 Magus-
(or you're using a query that's currently broken)
23:18 Magus-
there are a few edge cases that don't work right at the moment
23:19 Leonidas
23:20 Leonidas
So, I try to display only series which have more than 0 public_viewable watches
23:21 Leonidas
The condition was too hard for a simple exlude, at least I couldn't come up with something.
23:22 Magus-
.exclude(obj) is invalid, of course
23:22 Magus-
you have to use kwargs like every normal filter/etc
23:22 Magus-
something like .exclude(id=obj.id) would work
23:22 Leonidas
Magus-: the fun thing is, it does not crash. It crashes on the print
23:22 Magus-
well duh, querysets aren't evalutaed until you try to get data :)
23:22 sillyperson
Hi, I have a Q-related question. Due to a design-issue a object has a start_date field and a start_time field, and i want to get a queryset of objs with a date/time greater than right now, the pseudocode is something like: queryset = filter(start_time__gt=now.time() AND start_date=now.date()) OR start_date__gt=now.date(), -- as i read it, Q would do the job with: filter(Q(start_time__gt=now.time
23:22 sillyperson
(), start_date=now.date()) | Q(start_date__gt=now.date())) but I must be mistaken because that produces faulty output... any pointers?
23:22 Magus-
so you go and build the invalid one, and on the print it dies
23:23 notanumber
Can someone tell me why, when I update 'reports_to' in this: http://dpaste.com/38998/, 'supervises' also updates with the exact same content?
23:23 Magus-
because you didn't turn off the symmetrical option
23:24 Magus-
sillyperson: try using & to combine the first two, instead of foo,bar
23:25 gordonjcp
hrm
23:25 gordonjcp
I'm trying to use modelforms to edit a model
23:26 gordonjcp
how do I get it to populate the existing values of that particular object into the form?
23:26 notanumber
Magus, really? I read the description of symmetricl, but it didn'tseem to apply in this case. It did work when I put it on though, but thought I might it be a bug. Guess I was just reading it wrong.
23:26 sillyperson
christ!!! ... Magus- you're a saint :-)
23:26 Magus-
notanumber: symmetrical = what you add to one m2m is added to the other side of it
23:26 cccp
what should i do if i want to format a datetimefield in a newforms form(modemform) before outputting (i need 12.3.07 instead of 2007-3-12)? the boundfield.data just returns None - so what do i need to change?
23:26 Magus-
in this case, it's likely interpreting the 2nd m2m as the other side
23:26 Magus-
and any m2m to 'self' is symmetrical by default
23:27 cccp
modelform*
23:27 brosner
gordonjcp: pass in the instance.
23:28 Magus-
cccp: as far as I know you cannot change the initial display of the data in the form
23:28 Magus-
you could try a custom datefield and/or widget though
23:28 gordonjcp
brosner: pass it in where?
23:28 cccp
hm :/
23:28 brosner
gordonjcp: MyModelForm(instance=obj) as the docs say
23:29 notanumber
Magus, but that's still the case for two seperate m2m fields?
23:29 cccp
can i easily replace the normal widget with it? (i use a subset of the fields via a modelform)
23:29 Magus-
notanumber: every m2m to 'self' is symmetrical=True
23:29 Magus-
you could make 50, they'd all have that set
23:29 AzMoo
OK, so I need to authenticate with our AD server and mattmcc recommended a custom backend for the auth middleware. However, I need support for our AD groups as well. From what I've seen of the backend it's for user authentication only and groups are implemented as a db thing. Is there a way I can extend the Group functionality?
23:30 gordonjcp
brosner: aha, thanks
23:30 notanumber
Magus, oh. I see what what you're saying. That's an odd behaviour, isn't it? WHy would you want that.
23:30 Magus-
no it isn't
23:30 gordonjcp
brosner: next problem is that dropdowns don't work
23:30 Magus-
for instance, suppose you had a userprofile with a 'friends' m2m to self
23:30 Magus-
if user A is friends with B, B is friends with A
23:31 Magus-
symmetrical handles the other end automatically
23:31 wolfe
tada
23:31 wolfe
:P
23:31 gordonjcp
hrmm, this is going to take either more beer or more sleep to fix
23:31 brosner
gordonjcp: more info please
23:32 Magus-
notanumber: but since that's not /always/ desired, the option can be disabled
23:33 notanumber
Magus, that part makes sense. My case has "user" with two m2m fields: supervises & reports_to. Changing either one in a user records, changes the other. That's the part that seems odd to me.
23:34 notanumber
I would have thought they'd be distinct.
23:34 Magus-
notanumber: and normally they would be
23:34 Magus-
I think the symmetrical is getting in the way
23:34 Magus-
it may be a bug with that option, I don't know
23:35 notanumber
Magus, I thought it might be a bug. Didn't see a report for it though, so thought I'd confirm.
23:35 Magus-
I'm not entirely sure :)
23:35 Leonidas
Magus-: thanks, I got it working properly.
23:35 notanumber
Symmetricl=false did fix it though.
23:39 notanumber
Maybe I'll submit a bug report either way. Let the developers decide if it's a bug or not.
23:48 notanumber
Magus, actually, I lied. S=symmetrical=False didn't work. Now adding a user, "Bill
23:49 notanumber
, whom reports to "John". Added Both "John", & "Bill" to 'reports_to' & 'supervises' for John.
23:49 notanumber
and Bill
23:52 Magus-
hmm
23:52 Magus-
you could try using db_table to specify different tables for each m2m
23:52 Magus-
but definitely file a bug for that one
23:53 notanumber
Well, at least I know I'm not going crazy. heh. Can't type for crap tonight though...
23:55 speedy
whats the best way to extend user class?
23:55 Magus-
behold, the power of google
23:55 Magus-
23:55 Magus-
first hit
23:56 speedy
thanks magus, i went thru this post, but there are other methods, i'm asking about the best
23:56 Magus-
no there aren't
23:56 empty
what other methods?
23:56 Magus-
that's the only method
23:57 speedy
23:57 Magus-
that method is absolute shit
23:57 Magus-
so yah, use the b-list one
23:58 speedy
alright
23:58 malibu
lol..
23:58 empty that's just awful
23:58 speedy
yes it is lol
23:59 brosner
omg, seriously... what a shame
Page 25 of 25   ← Previous  (2,495 total)