gcbirzan: from the docs it looked like the part after the : will be the args?
from the docs: Here’s an example filter definition: def cut(value, arg): """Removes all values of arg from the given string""" return value.replace(arg, '') And here’s an example of how that filter would be used: {{ somevariable|cut:"0" }}
gcbirzan
nick1: The problem is, that argument is not the value of title, it's the string title.
nick1
hmm but i thought i wanted the string
gcbirzan
Oh, or not
nick1
so in the filter i have return Course.objects.get(crn=crn).arg
gcbirzan
I think it's trying to look it up in the context.
nick1
which should be calling return Course.objects.get(crn=68041).title
gcbirzan
Yeah, it's trying to look it up in the context. Quote title in there and it will work.
My template-foo is really weak, I honestly haven't used it for anything serious in like 5+ years :P
RandomSerb
when creating manytomany with through param, is it better to have manytomany on both models?
GinFuyou
I don't think you can have it, simple reverse relations should be enough already
amirpro joined the channel
LordVan
hmm css is driving me nuts .. anyone here who knows about multiple style classes on an element and which of them takes precedence when they define the same property?
GinFuyou
latest appearing in style sheet I think?
LordVan
GinFuyou, well that is what i found/thought
but it doesn't matter what i do the one linked stylesheet always overwrites even in-line style tags in the main html file
GinFuyou
in-line should take top priority if not !important used at least
LordVan
hm
senn joined the channel
GinFuyou
You probably missed something
LordVan
maybe !important is used (i am using timesheet.js to generate a timesheet ..
GinFuyou
Though I find I don't get my css quite often myself
LordVan
i prefer not to have to do too complex css where I can avoid it ^^
GinFuyou
Sure
LordVan
GinFuyou, ! important did the trick
;)
maybe the sledgehammer approach, but who cares ;)
that aside
I have to say timetable.js is nice
lolidunno joined the channel
Unlimiter has quit
rpkilby joined the channel
aussiejames joined the channel
rsrx joined the channel
Donitzo has quit
GinFuyou
I try to avoid important always, but sometimes just have to use it. for example non-customizable third-party widgets with inline styling
just in center of your footer...
Donitzo joined the channel
inad922 has quit
aalmazan joined the channel
LordVan
yeah
btw
if I want to have '&' in my template as'&' and not '&' (but not touch the other html tags) do i need a custom filter?
nick1
LordVan: maybe %verbatim?
LordVan
i didn't know that .. let me have a look
TripFandango joined the channel
Haudegen has quit
TripFandango has quit
jtiai, it seems django templates do support month without leading zeros ('n'
and 'j' for day without zero padding
amusingly it is not supported for minutes and seconds
LordVan: Uses a similar format as PHP’s date() function (https://php.net/date) with some differences.
LordVan: So, yes. :-)
GinFuyou
RandomSerb, so does it work? I guess with through it could
LordVan
well it does what i need it to so ^^
eperzhand joined the channel
gcbirzan
so many of those filters are so bad.
lapideviridi has quit
phone2numeric is probably the worst tag ever. date is a close second.
make_list serves no purpose I could understand. divisibleby should not be a filter
addslashes makes baby Jesus cry. (they're not slashes)
capfirst is amazing, except it's called capitalize
filesizeformat¶
didn't we move every humanize stuff to an external lib?
I'm confused as to why first cannot be written as foo.0
get_digit is 1 indexed
last and join are decent. yay.
Haudegen joined the channel
why is lenght_is needed? linenumbers is meh? how often do you need that
fikka joined the channel
A wrapper around pprint.pprint() – for debugging, really.
slice should be supported syntax, wtf
floatformat can go.
striptags gives you a false sense of security
time is... php. timesince and until are again humanize stuff, urlize is confusing, it converts URLs and email addresses into links... some weird stuff about www in there that makes my brain hurt
half of the filters are useless or worse
fikka has quit
vdboor has quit
zeus1 joined the channel
vdboor joined the channel
fikka joined the channel
elbarto_e joined the channel
acm1pt has quit
tbp has quit
tbp joined the channel
rookie101 joined the channel
tbp has quit
tbp joined the channel
tbp has quit
tbp joined the channel
lolidunno has quit
vdboor has quit
audioburn joined the channel
take_flight joined the channel
djapo joined the channel
sarp joined the channel
take_flight has quit
newdimension joined the channel
xcm joined the channel
tbp has quit
tbp joined the channel
fikka has quit
GraysonBriggs joined the channel
GraysonBriggs has quit
roadie has quit
fikka joined the channel
fub
When using forms and defining the fields in the form with the Meta.fields tuple, how do I set additional things like that a field is required?
I dont want to make this field required always (by defining this in the model)