0:00 AM
trewq__ joined the channel
0:00 AM
cyberspace- has quit
0:01 AM
riddle has quit
0:01 AM
SmileyChris
Nelluk: don't you just want dict['SubDict'].get('SubDictKey') then?
0:01 AM
dman777_alter has quit
0:01 AM
heiths2 joined the channel
0:01 AM
cyberspace- joined the channel
0:01 AM
dirn has quit
0:01 AM
FunkyBob
igorline: yes, not filter it for null=False
0:01 AM
riddle joined the channel
0:01 AM
knite_ joined the channel
0:01 AM
maroloccio has quit
0:01 AM
SmileyChris: well, not if dict['SubDict'] might be an object with a get method :P
0:02 AM
JoeQuery has quit
0:02 AM
mattmcc
Sounds like a case of trying to be too clever.
0:02 AM
FunkyBob
yes
0:02 AM
I would just break it into two lines
0:03 AM
Nelluk
SmileyChris: yeah. i was looking to see if there was a one-liner that would silently give a default if the first key didnt exist. but two lines is fine
0:03 AM
patrick91 has quit
0:03 AM
culturel_ joined the channel
0:03 AM
0:03 AM
SmileyChris
Nelluk: so you want dict.get('SubDict', {})['SubDictKey']?
0:03 AM
er, .get
0:03 AM
Nelluk
heh thats clever
0:03 AM
SmileyChris
ah whatever
0:04 AM
i'm not actually sure what you want :P
0:04 AM
Nelluk
that would do it i think
0:04 AM
FunkyBob
SmileyChris: only if you can guarantee d['SubDict'] yields a dict-like object
0:04 AM
Ronald_Reagan has quit
0:04 AM
SmileyChris
FunkyBob: well that's already an assumption
0:04 AM
Nelluk
yeah that is an assumption
0:05 AM
Synapsis joined the channel
0:05 AM
FunkyBob
oh, wait... I misread the question
0:05 AM
SmileyChris
Nelluk: so you want json.get('Prices', {}).get('ItemPrice', ())
0:05 AM
Fuyou
Heh, my tsak running every 45 seconds going to finish in about 9 hours
0:05 AM
FunkyBob
"will throw an exception if SubDict is not in Dict"
0:05 AM
garrypol_ joined the channel
0:05 AM
dict['SubDict'] will do that
0:05 AM
SmileyChris
which is what i said first :P
0:05 AM
garrypolley has quit
0:05 AM
culturelabs has quit
0:05 AM
RichardBronosky has quit
0:05 AM
knite has quit
0:05 AM
josuebrunel has quit
0:05 AM
amahon has quit
0:05 AM
webscrapper1 has quit
0:05 AM
trewq_ has quit
0:05 AM
Inoperable has quit
0:05 AM
semente has quit
0:05 AM
crisisking has quit
0:05 AM
needlz has quit
0:05 AM
dpn` has quit
0:05 AM
Vadtec has quit
0:05 AM
myusuf3 has quit
0:05 AM
nickmeharry has quit
0:05 AM
phobi has quit
0:05 AM
DLange has quit
0:05 AM
knite_ is now known as knite
0:05 AM
igorline
FunkyBob, but fields is a list, how do i filter it?
0:05 AM
Nelluk
now we are all getting confused
0:05 AM
Synapsis is now known as Inoperable
0:05 AM
kbambz has quit
0:05 AM
myusuf3 joined the channel
0:05 AM
incitonetworks has quit
0:06 AM
crisisking joined the channel
0:06 AM
DLange joined the channel
0:06 AM
Vadtec joined the channel
0:06 AM
RichardBronosky joined the channel
0:06 AM
FunkyBob
snap!
0:07 AM
not_null = filter(lambda x: x.null, Model._meta.fields) :)
0:08 AM
Nelluk
what is () a shotcut for? i would have thought i'd need .get("ItemPrice",[]) to give me an empty List as default
0:09 AM
FunkyBob
() is a tuple literal
0:09 AM
just as [] is a list literal
0:09 AM
Nelluk
got it
0:09 AM
FunkyBob
and {} is a dict, though the same syntax can make a dict or set literal
0:09 AM
felixsamora joined the channel
0:10 AM
schinckel
FunkyBob: OMG HOW DO I MAKE AN EMPTY SET USING LITERAL NOTATION???
0:10 AM
:)
0:11 AM
hoot joined the channel
0:11 AM
kbambz joined the channel
0:11 AM
ehmatthes joined the channel
0:12 AM
josuebrunel joined the channel
0:12 AM
SmileyChris
I nominate ⁅⁆
0:12 AM
Nelluk
ha
0:12 AM
SmileyChris
make people type unicode characters
0:12 AM
amahon joined the channel
0:12 AM
schinckel
Surely ∅ is appropriate then?
0:12 AM
dirn joined the channel
0:12 AM
SmileyChris
if there's a left and right half of it as two separate chars ;)
0:13 AM
must stay consistant!
0:13 AM
zenoamaro has quit
0:13 AM
schinckel
See, we should have jumped on using other characters for set literal boundaries:
0:14 AM
«a,b,c»
0:15 AM
SmileyChris
⦃a, b, c⦄
0:15 AM
schinckel
0:16 AM
(Erlang's bit syntax and matching is actually really cool, but we are drifting dangerously off-topic now… :)
0:17 AM
iqualfragile joined the channel
0:17 AM
crunch-choco has quit
0:17 AM
Nemus joined the channel
0:17 AM
dpn` joined the channel
0:22 AM
demi1 has quit
0:22 AM
kbambz has quit
0:23 AM
dali has quit
0:23 AM
JulianGindi
I want to store an array as a model attribute. What would be the best way to accomplish this?
0:24 AM
igorline has quit
0:24 AM
unbracketed has quit
0:28 AM
rasca joined the channel
0:28 AM
logix812 has quit
0:30 AM
felixsamora has quit
0:30 AM
igorline joined the channel
0:31 AM
mribeirodantas has quit
0:31 AM
mribeirodantas joined the channel
0:31 AM
dali joined the channel
0:32 AM
kbambz joined the channel
0:32 AM
hwrd|work has quit
0:33 AM
Fuyou
<JulianGindi> as no suggestions from elders, I propose to yaml it )
0:33 AM
rideh joined the channel
0:33 AM
Jax
JulianGindi: just put it on the model? django's models.Model is like any other class
0:33 AM
or you want to store the array in the database?
0:34 AM
JulianGindi
Jax: Yeah, I do want to save it in the DB. Should have been more clear
0:34 AM
Fuyou
(I guessed later)
0:34 AM
Jax
sounds fishy, but if you must, and performance is not an issue, then serialize it (if the content permits)
0:34 AM
dmanderson has quit
0:34 AM
and put it in a TextField or just write your own field, ArrayField which does the serializing/deserializing for you
0:35 AM
can you convert it to json?
0:35 AM
Fuyou
Was there a TextField? I think its only CharField in models
0:35 AM
PKKid2 joined the channel
0:35 AM
Jax
no there is a TextField
0:36 AM
dirn has quit
0:36 AM
JulianGindi
Jax: Yeah I think I'll convert it to JSON first
0:36 AM
jasondotstar is now known as jasondotstar|afk
0:36 AM
dirn joined the channel
0:37 AM
basti-mbp joined the channel
0:38 AM
hwrd|work joined the channel
0:38 AM
Fuyou
Jax, ah you right, my bad
0:38 AM
enemykite joined the channel
0:38 AM
dirn_ joined the channel
0:38 AM
Jax
time for bed, gnite all
0:39 AM
FunkyBob
later
0:39 AM
dirn has quit
0:39 AM
JulianGindi: why are you storing an array of data opaquely to your DBMS?
0:39 AM
hyperair has quit
0:39 AM
kenbolton has quit
0:39 AM
epopt37 joined the channel
0:40 AM
Jax has quit
0:41 AM
kristallpirat joined the channel
0:41 AM
JulianGindi has quit
0:41 AM
felixsamora joined the channel
0:41 AM
basti-mbp has quit
0:43 AM
kbambz has quit