my goal is to display "EDT" instead of "-14400". I can prolly modify the event somehow and make the format I want with a proper tzname using strftime() or such...
brunch875 has quit
nincha
yeah are you trying to show the time in the user's timezone?
lacrymology joined the channel
papna has quit
Y04NN has quit
because you said you want it to show "EDT or PDT"
jonez
nincha, eventually, yes. at the moment it's ok if I see "EDT" which is the server's timezone
nincha
pl
ok
jonez
I would like the ability to add an event in whatever timezone I want.. might be pacific time, or central, or whatever.
nincha
yeah you have to explicitly ask the user what zone they want it displayed in
no way for it to detect their timezone that I know of
but yeah I don't know if there's a way to do that through the filter
jonez
I'll prolly make a field in the user profile for that
sorry I can't help much more than that other than doing some trial and error
djosh has quit
milardovich joined the channel
dardevelin joined the channel
ellmetha1 joined the channel
ellmetha has quit
fission6
anyone have a go to tempalte tag / filter for dict access
FunkyBob
been done many times
but really, stop passing dicts to your context :)
Biwaa joined the channel
nincha
ok here's what I concluded, the "date" and "time" filters in a template use the PHP style format strings, so if you wanted to do it all in the template you would do:
{{event.startdate|date:"D d M Y" }} {{ event.startdate|time:"H:i T" }}
MarkusH
FunkyBob: double checking on my djangocon talk: I use GIN indexes on JSONB fields, GIST on spacial fields and with a unique constraint to e.g. prevent time-range overlaps (room booking and such), right?
sjdines joined the channel
ellmetha1 has quit
fission6
FunkyBob: OH BOY, i don't want to but essentially i need to do some looks up as a result of the ORM not letting me do an annotate query effiecently which leads to me having to do a few queries and then map items in to each other to get some extra info
FunkyBob hands fission6 a fresh new yak shaving kit
fission6
what does that mean
FunkyBob
fission6: pull the work out of the template... either do it in the view, make a smarter data type, or move it into a filter/tag
fission6
i did move the look up into a template tag
but i need to pass the dict in
Biwaa has quit
Koterpillar
why don't you know the _key_ ahead of time?
milardovich has quit
fission6
i mean i could, if i did some data restructing inside the view
FunkyBob
fission6: but I also applaud you explaining the path that lead you to this point
Koterpillar
FunkyBob: "stop passing dicts to your contexts" should be "stop messing around with dynamic keys"
fission6
FunkyBob: its been a damn painful 24 hours
i have everything working i want to deploy but the annotate query was just not performant, i then made it raw SQL which is nasty and got it working and it performed a bit better, now I just threw in the towel and did seperate queries for what I need which are VERY fast but i need to associate it to "Brands" which is what I am listing in my template
nincha
jonez: {{event.startdate|date:"D d M Y" }} {{ event.startdate|time:"H:i T" }} worked for me
FunkyBob
fission6: well, for some background please provide the query and how it's poorly executed
I am going to make a custom filter to make things easier
FunkyBob
fission6: I mean ,a dict lookup filter is _trivial_ .. so go with that for the short time
but know that you are accruing technical debt
fission6
right
how woud you approach this
FunkyBob:
Koterpillar
you know the problem is hard when your dpaste times out
jwhitmore has quit
fission6
lol
FunkyBob
fission6: sorry, I really need to focus on my paid work right now...
sounds like Koterpillar is on the case, though
MarkusH
nighty-night
ellmetha joined the channel
FunkyBob
(client dumped a list of fixes/changes on me 3 days before end of contract)
fission6
totally understood
FunkyBob
MarkusH: see you soon :)
Koterpillar
fission6: I know little about queries though
so I'll just attack the map problem
imagine you have your filter as {{ dict|key:mykey }}, what will you write then?
fission6
what do you mean
Koterpillar
that's your filter for dict access
that results in dict[mykey]
what do you want to do with it?
hutch34_ joined the channel
iamhssingh has quit
FunkyBob
win 4
tourdownunder has quit
fission6
use it
{% with |get_item as value %} …
jonez
how do I make sure my 'templatetags' module is imported? I made a 'datestamp' filter, and I consistently get an error about how 'datestamp' is not a defined tag library