2008-6-4

23:02 brosner
hey ericflo. want to talk to you about #6095
23:02 DjangoBot
23:03 ericflo
brosner: KK, I haven't had time to look at it in quite a while, but I'm ready to start looking at it again.
23:03 brosner
cool. i'd like to revisit the add/remove limitation
23:04 ericflo
I was thinking about that myself, and I agree.
23:04 ericflo
We gotta get Russ on here
23:04 ericflo
He's the one who suggested to remove it
23:04 brosner
yeah
23:04 ericflo
And the ticket's not really a good place for that kind of discussion
23:04 ericflo
The ticket is actually getting kind of huge
23:05 brosner
i guess it just feels really limiting that its called a ManyToManyField and ModelForms wont work
23:05 brosner
i understand why
23:05 ericflo
Me too
23:05 ericflo
But we do a similar thing with update
23:06 ericflo
and how one arg applies to all of the items in the qs
23:06 brosner
like my really specific (maybe not) use case was having an intermediary table where the "extra" fields were determined automatically like a sort_order.
23:06 ericflo
brosner: Not sure what you mean, like they have a default?
23:07 brosner
basically. i wrote my own version of save_instance to deal with it
23:07 brosner
ugh, this is a tough one
23:08 ericflo
brb 5 min :(
23:11 trbs
DjangoBot, who semente
23:11 brosner
pm the bot
23:11 trbs
sorry, my bad
23:13 ericflo
brosner: OK back
23:16 ericflo
brosner: The one thing that's nice about the current solution, is that once it gets into trunk, we can extend the syntax later for more syntactic sugar.
23:17 ericflo
brosner: As people start to use intermediary models, there'll be more people who can think about a good syntax
23:17 ericflo
brosner: That's both good and bad, I guess
23:18 brosner
well i begin to wonder if that will end up being just given intermediary model instances?
23:19 ericflo
What do you mean?
23:20 brosner
if maybe there was an extra method that just took the intermediary model instances. so like Membership instances
23:21 brosner
then something like a clean method could do that in a ModelForm for instance
23:21 ericflo
Extra method on what?
23:21 brosner
the many to many manager
23:21 ericflo
But then you still have to query for those instances directly, meaning there's no real gain in functionality, unless I'm seeing it wrong.
23:22 brosner
i am not talking about querying though
23:22 brosner
those use cases seem to be covered
23:22 brosner
unless i am missing something
23:25 ericflo
brosner: So as an example, my_group_instance.members.add(my_person_instance, Membership(person=my_person_instance, group=my_group_instance, date_joined=datetime.now(), invite_reason="She is cool."))
23:25 ericflo
?
23:26 jacobkm
ericflo: I think, for a first cut, you're overthinking the problem... I'd be pretty happy with just creating Memberships by hand at first; a suitable syntax for add/remove can come later if it presents itself.
23:27 ericflo
jacobkm: Yeah, that's where we're at right now.
23:27 jacobkm
were it up to me, I'd just disable add/remove on m2m's with intermediary models and get the rest working and checked in. then work on the rest
23:28 brosner
fair enough, but i have been using the patch and am dealing with this problem ;)
23:28 brosner
well i already dealt with it, but trying to help otu
23:28 ericflo
jacobkm: That's the current solution. In fact, the methods are dynamically removed so that autocompletion from some IDEs won't even suggest it.
23:28 ericflo
jacobkm: (As per Russ's request)
23:28 jacobkm
Ah, so you're more talking about where to go next.
23:28 jacobkm butts out :P
23:29 ericflo
jacobkm: Yeah, because not having add/remove is kind of annoying, however, there doesn't seem to be a very good solution :(
23:29 brosner
ericflo: yeah i am not trying to implement a solution now. id be happy if it went in now :)
23:29 jacobkm
constructing the intermediary model by hand seems simple enough.
23:29 jacobkm
Another option would be to expose the intermediary model through a related manager...
23:30 jacobkm
So something like Person.membership.all() / Group.membership.all()
23:30 ericflo
hmmm...
23:30 jacobkm
There'd obviously need to be some sort of an "intermediary manager name" attribute so that you don't get clashes on multiple bits.
23:31 ericflo
Well since you already have to put foreign keys, you already get the related manager from that on particular instances.
23:31 jacobkm
Ah, right.
23:31 ericflo
So person.membership_set.all()
23:31 jacobkm
Nice use of the time machine there, ericflo :)
23:31 ericflo
jacobkm: thanks, heh
23:32 ericflo
jacobkm: I mean, like brosner was saying before, querying is pretty much taken care of, it's the CUD of CRUD that's wonky still.
23:32 jacobkm
meh, it's just a little more verbose
23:33 ericflo
jacobkm: I'll massage the patch a little tonight as per some of Russ's suggestions, but if you're just looking for what you said earlier, it's ready.
23:34 jacobkm
ericflo: yeah; it worksforme pretty well. I'll give Russ a chance to review that little changes you make, but if he's busy I can check it in soonish too. Bug me next week if you've updated the patch and not gotten any review, OK?
23:35 ericflo
jacobkm: Sounds good.
23:35 jacobkm
So the patch is against newforms-admin? Is that right?
23:35 jacobkm
Er, what I mean is: do you have it against trunk, too? Or is there a reason not to apply it to trunk?
23:36 ericflo
jacobkm: I had been maintaining patches against pre-qsrf trunk, qsrf, and newforms admin, but it hasn't been updated since PyCon due to other stuff getting in the way.
23:36 ericflo
jacobkm: Tonight I'll bring it up to trunk.
23:36 brosner
apply against trunk. there is one bit for nfa that removes the m2m. i can apply that once merged over
23:36 jacobkm
That's what I'd like to do, yeah.
23:36 jacobkm
Cool.
23:36 brosner
ericflo: i updated after pycon
23:36 ericflo
Thanks brosner :)
23:37 brosner
actually after some qs-rf stuff you did i think
23:37 ericflo
brosner: With the state of the patch, is there currently no way to get an inline view working of the intermediary stuff in newforms admin?
23:38 brosner
well it is done explicitly
23:38 brosner
just make an inline on the intermediary model
23:38 ericflo
brosner: Oh I see, awesome!
23:39 ericflo
brosner: I think that's a pretty decent solution, unless it could somehow be automated for the most basic case?
23:39 brosner
i wonder if that could be done automatically. maybe not worth it
23:40 brosner
yeah if we did it implicitly it might cause some headaches to get more customized unless it could be easily overridden which at this point would be nasty
23:42 ericflo
brosner: Ok then let's forget about it, explicit is good
23:42 brosner
yep. agreed.
23:43 brosner
that was my comment near the end
23:44 ericflo
Gah gotta go, dad's birthday. I'll get #6095 up to speed tonight.
23:44 DjangoBot
23:45 brosner
thanks ericflo