2008-6-11

03:09 brosner
http://dpaste.com/55961/ <-- code review me for max_num in newforms-admin formsets if anyone wants to
03:12 Alex_Gaynor is taking a look
03:15 Alex_Gaynor
0 for max_forms means no limit I assume?
03:16 brosner
right
03:18 Alex_Gaynor
Looks good by me, except on line 103 isn't the 0 before the colon unnescesary
03:20 brosner
i am pretty sure if there is no 0 it evaluates
03:21 brosner
i remember being bit by that. not 100% sure though ;)
03:24 Alex_Gaynor
Oh, I have never tested that, time to go look at the QS code :P
03:25 Alex_Gaynor
03:26 Alex_Gaynor
Nope, it doesn't
03:26 Alex_Gaynor
03:28 brosner
yeah. hang on let me open my work source and look at my comment
03:28 Alex_Gaynor
That may be a pre-qsrf relic
03:28 brosner
and not 100% sure
03:28 brosner
probably was
03:29 brosner
like it really matters in this case anyways ;)
03:30 brosner
ah, i see
03:30 brosner
yeah i was confused
03:30 brosner
[0:1] != [0] ;)
03:30 Alex_Gaynor
:D
03:31 brosner
[0] will grab the whole result set and give you [0] on the _result_cache while [0:1] would do the limit. thats what i had commented in my code.
03:32 Alex_Gaynor
Is that still true?
03:32 brosner
yes
03:32 Alex_Gaynor
I'm guessing its no longer an issue because the iterator is efficient, it will only read the first few objects into memory
03:33 brosner
but in my case the query the database got was making it really slow
03:33 Alex_Gaynor
Ah, fun
03:34 brosner
it may be efficient in django, but the database chugs away at the select * from table;
03:34 brosner
;)
03:34 Alex_Gaynor
Hehe, right
03:34 brosner
ok cool i remove that 0 in my patch. make it look better ;)
03:35 brosner
i'll get this committed tonight
03:35 Alex_Gaynor
Awesome, what other big things are left, after this?
03:36 brosner
there is one last compatibility ticket, but it is waiting on a newforms change i believe
03:36 brosner
and the rest should be non-blockers. and some docs
03:36 Alex_Gaynor
I think nfa should be using django-ajax-validation :P
03:37 brosner
heh, no reason for you not to use it with it if you like
03:38 Alex_Gaynor
Actually, it would be really easy, since the JS is non intrusive, I'd have to make a custom callback I think... I'm going to play with this tommorow I think
04:01 Alex_Gaynor claps and dances, accompanying django on the march to merge!
04:02 brosner
:)
04:06 Alex_Gaynor
What was the newforms issue you said was blocking nfa?
04:06 brosner
look at#5731. that is the nfa ticket for the missing feature
04:06 brosner
#5731
04:07 DjangoBot
04:08 brosner
maybe it can be avoided. i need to look at the patch in depth again
15:44 SimonW
newforms-admin chaps: need to sanity check a suggestion for making view subclassing a bit more useful
15:45 SimonW
I want to be able to add extra stuff to the context used in changelist_view and friends
15:45 SimonW
at the moment it doesn't provide a hook for adding to the context, and it returns a pre-rendered template so you can't intercept it
15:45 SimonW
There are two possibilities for fixes, both based around passing an optional argument to changelist_view
15:46 SimonW
def changelist_view(self, request, extra_context=None)
15:46 SimonW
then towards the end of the method:
15:46 SimonW
c.update(extra_context or {})
15:46 SimonW
Option 2: def changelist_view(self, request, return_context=False)
15:47 SimonW
if return_context is True, the method returns just the context rather than rendering it to a template and returning an HttpResponse
15:47 SimonW
Option 1 matches what the change_view function does already
15:47 SimonW
but Option 2 is slightly more powerful - since you can modify existing things in the context and even load and render a different template
15:48 SimonW
Option 2 is a bit weird though, because it means that you're changing the return type of the function based on an argument you pass to it
15:48 brosner
i would tend to lean towards the former. to render the templates that they do now the latter would make it harder since it relies on some local variables in those functions
15:48 david`bgk
Option 2 looks more interesting for agregation too
15:50 david`bgk
that's always the same problem (at least for me) of current vs. logic+responders
15:51 brosner
ultimately i would prefer to see a class based approach where those bits of functionality can be overridden and can be made consistent across views if need be
15:52 SimonW
hang on, pasting better example to dpaste.com
15:52 david`bgk
brosner, I do agree :)
15:56 SimonW
15:56 SimonW
that shows what it looks like with each option
15:56 SimonW
having written them out like that, I'm leaning towards option 1
15:56 SimonW
the only advantage of option 2 is it gives you more flexibility in selecting the template
15:56 SimonW
but there are other ways we can do that which would have a nicer overall API
15:56 brosner
option 2 would force the template change
15:58 SimonW
For templates, I want to be able to say "class MyAdmin(ModelAdmin): changelist_template = 'path/to/template.html' "
15:59 SimonW
I figure if you want a dynamic template you can still have one, you just override changelist_view and have it modify self.changelist_template before calling super
16:01 brosner
SimonW: how do you feel towards a class-based approached to customizing the views?
16:03 SimonW
brosner: I love it, but if it gets added to newforms-admin and breaks backwards compatibility I will probably be brutally murdered by my colleagues
16:03 SimonW
who have spent several months coding against existing newforms-admin under the expectation that there weren't going to be any major API changes before it got merged
16:04 SimonW
minor backwards compatibility breaks aren't a problem, but major ones will probably lead to my death
16:04 SimonW
how large are the proposed changes for class-based view customisation?
16:05 brosner
are you already doing view overriding?
16:05 SimonW
in a few places yes
16:05 SimonW
I can grep our source and find out how much
16:06 brosner
from what i have seen of jkocherhans' stuff is that those instances would be broken if thats what he ends up doing
16:06 brosner
well actually probably not if you are duplicating functionality
16:07 SimonW
hmm... turns out we're not doing it that much - only in three or four places
16:07 SimonW
got a link to his stuff that illustrates the API?
16:07 jkocherhans
SimonW: let me take a quick look at my notes and translate them to the pastebin
16:08 david`bgk
SimonW, #6735
16:08 DjangoBot
16:09 david`bgk
and there is a thread about ModelView on the devel list
16:10 SimonW
looks pretty awesome to me
16:10 SimonW
especially if it means newforms-admin stuff can be used as regular generic views separate from the rest of newforsm-admin
16:11 jkocherhans
16:11 SimonW
how does formfield_for_dbfield fit in that?
16:12 SimonW
that looks really nice - would make it a cinch to create reusable custom admin view classes
16:12 david`bgk
16:12 jkocherhans
SimonW: not sure yet. I want it to die, but I'm still not sure how to get the admin widgets to work without it.
16:13 SimonW
Did you see my choices_for_* etc proposal?
16:13 SimonW
I got the code for that written the other day, haven't tried it out on anything yet though
16:13 SimonW
could really do with a massive newforms-admin testing application that exercises ALL of the admin features in one app
16:13 jkocherhans
yes, but I don't remember much about it right now. my head has been elsewhere
16:13 jkocherhans
definitel
16:13 jkocherhans
y
16:14 SimonW
I've gotta head for my train unfortunately
Page 1 of 2   Next →(141 total)