is it possible to add/remove modelAdmin's inlines ?
I want to exclde some inlines if they are unnessecary (already filled in)
jrwren
there isn't a single max_timestamp_id, there is a max for each t1
aleksm joined the channel
PKKid
jrwren, I think I understand.. 2 sec
jrwren
t1 is one to many t2.
rsmol has left the channel
kinabalu has quit
jadel has quit
m0no has quit
bryguy joined the channel
m0no joined the channel
jcarbaugh has quit
F1skr joined the channel
pyxorg has quit
atula joined the channel
void has quit
PKKid
jrwren, How many objects do you expect t1, t2 to have?
void joined the channel
jrwren
~5k
and then anywhere from 1 to dozens on teh many size to t2
jita joined the channel
exit2
is there anything I can do to automatically fill in a field of a model from models.py? I know I can do default='Whatever', but that doesn't actually fill the field in
PKKid
jrwren, Also, I believe the ORM cannot do that query, at least not without storing a list of max_ids and using the __in filter.. which is a bit icky.
sligodave joined the channel
jcarbaugh joined the channel
jrwren
i'm thinking about .extra(where=['???timestamp=(select max(t3.timestampe) from ??? as t3 where t3.???= ??? )']
but I don't know how I can fill in the table and field names from orm in the extra where
TopRamen has quit
i guess I can just hardcode, but I'd need to know the table alias name used if any... I guess django.db.connection.queries shows me there is no such alias
activus1
Z_A_M: how do I return just plain text to the screen so I can see what was passed in ?
aaroncm has quit
aezell has quit
nickmeharry has quit
gremly has quit
PKKid
jrwren, I wouldn't dig too deep into the ORM internals to write this. A raw query seems much more readable/maintainable imo.
gremly joined the channel
gerard0 joined the channel
nickmeharry joined the channel
jroll has quit
cewing|afk is now known as cewing
fmcgeough has quit
activus1
return HttpResponse('POST')
got it
jrwren
PKKid: thank you for your help
PKKid
jrwren, Also note: this seems like a slow query either way. It might be worth flagging the max_timestamp rows when new rows are added. That would make this query blazing fast, easier to read (at the cost of slower writes to the DB)
sayan joined the channel
jrwren
the select n+1 is insanely slow.
yassine has quit
the subquery is very fast.
Alws0nth3rn joined the channel
yassine joined the channel
novation has quit
PKKid
if the rows were flagged, then you could do something simple like "SELECT * FROM t1 WHERE t1.max_flag"
jroll joined the channel
Shariq has quit
it also seems like this could be re-written using GROUP BY. Unless im missing something..
jrwren
i thought group by at first too, but couldn't figure how to write it, so I ended up with this WHERE subquery
good point on the max_flag, we'd have to maintain it, but should simplify things.
if it were groupby,I'd only want to groupby t2.id (kinda like turning that one to many into a one to one based on max(timestamp) )
liefy joined the channel
but if I groupby t2.id only, sql errors that t1.id must appear in group by since it was in the aggregate
sayan has quit
maybe a group by and a join
hansy has quit
yes.
i must have first translated that gist incorrectly. I think I see now.
jita has quit
I should be able to follow that post and get it to work.
dmg412 joined the channel
hrm, or not.
andrewjsledge has quit
the group by on t1 works, but once I join t2 it does not.
jdo_dk has quit
PKKid
hmm
im curious now.. :)
dmg412
Starting with django 1.4, I am getting an issue where I am getting apache processes hanging forever. They seem to be stuck trying to get a lock in the _remove_receiver method (from the mod_wsgi stack traces). Has anyone come across anything similar to this? We can reproduce the issue in 1.4 but not using 1.3. http://pastebin.com/iPe0HjRv
Adys_ joined the channel
scooz joined the channel
chrisstreeter joined the channel
Adys has quit
jj0hns0n has quit
jj0hns0n joined the channel
randil joined the channel
radez has quit
andym has quit
PKKid
jrwren, Still here..
?
jita joined the channel
cyborg-one joined the channel
mlavin has quit
jonathanchu joined the channel
jita has quit
Or1on joined the channel
kilae has quit
jrwren
PKKid: I'm going with extra(where=...
and the subquery.
i couldn't get a groupby having working.
marcosmoyano has quit
i could probably do it with 2 queries, the first being groupby and then the second being the old way with an additional IN but that IN value would have the 5000 values, not what I want.
PKKid
jrwren, is it working?
jrwren
looks like it.
goldfish_ has quit
i still need to profile the big picture, but this piece is great.