9:49 AM
jas02 has quit
9:49 AM
chicocvenancio_ joined the channel
9:50 AM
__love__ joined the channel
9:50 AM
chicocvenancio_ has quit
9:50 AM
chicocvenancio_ joined the channel
9:50 AM
om_henners has quit
9:51 AM
jas02 joined the channel
9:52 AM
kennethlove has quit
9:52 AM
chicocvenancio has quit
9:54 AM
redir joined the channel
9:56 AM
aclark joined the channel
9:56 AM
z1r0_ has quit
9:58 AM
om_henners joined the channel
9:58 AM
chicocvenancio__ joined the channel
9:59 AM
Nizumzen joined the channel
9:59 AM
mnemonicj has quit
9:59 AM
jas02 has quit
10:01 AM
nikivi has quit
10:01 AM
sborza_ joined the channel
10:01 AM
edigiacomo has quit
10:01 AM
georgemarshall has quit
10:01 AM
fletom has quit
10:01 AM
sonicrocketman has quit
10:01 AM
cybo_ has quit
10:01 AM
__peke__ has quit
10:01 AM
chicocvenancio_ has quit
10:01 AM
levlaz has quit
10:01 AM
monokrome joined the channel
10:01 AM
sirecote joined the channel
10:01 AM
BreakerZero joined the channel
10:02 AM
cybo_ joined the channel
10:02 AM
aclark joined the channel
10:02 AM
sonicrocketman joined the channel
10:02 AM
mnemonicj joined the channel
10:03 AM
Leeds has quit
10:03 AM
nikivi joined the channel
10:04 AM
georgemarshall joined the channel
10:04 AM
jas02 joined the channel
10:04 AM
Anarchic has quit
10:05 AM
nakiya has quit
10:05 AM
mattmcc_ has quit
10:06 AM
__guy__ joined the channel
10:06 AM
Anarchic joined the channel
10:07 AM
bahamas joined the channel
10:07 AM
sarp joined the channel
10:09 AM
jas02 has quit
10:11 AM
empedokles78
How can I display entries of a M2M field from a Model which I passed as a dictionary to the template with template tags?
10:13 AM
negaduck joined the channel
10:14 AM
kezabelle joined the channel
10:14 AM
dodobrain joined the channel
10:15 AM
fikka
empedokles78: either related_name if defined, or if the name fis for eg names, then names_set
10:15 AM
jarshwah joined the channel
10:15 AM
jarshwah has quit
10:16 AM
bakirelived has quit
10:16 AM
hmm or names.all
10:16 AM
jarshwah joined the channel
10:16 AM
skali joined the channel
10:17 AM
bakirelived joined the channel
10:17 AM
om_henners has quit
10:18 AM
anddam joined the channel
10:19 AM
hmm or names_set.all :D
10:19 AM
dodobrain has quit
10:20 AM
rahulch joined the channel
10:20 AM
om_henners joined the channel
10:20 AM
empedokles78
fikka, do I need to get and pass these as a seperate data dictionary to the template?
10:20 AM
(in my views)
10:21 AM
skali has quit
10:21 AM
bakirelived has quit
10:22 AM
bakirelived joined the channel
10:24 AM
magellanic has quit
10:26 AM
fikka
empedokles78: no, the main entity has them when you generate the template
10:27 AM
FunkyBob
empedokles78: dicts don't play well with templates, unless you already know all the keys
10:28 AM
fikka
FunkyBob: I thikn he meant passig in model entity in a dict like {'main': main_obj}?
10:28 AM
FunkyBob
ah
10:29 AM
fikka
and so then in the templates it should be {% for name in main.names_set.all %}
10:29 AM
FunkyBob
fikka: when you say entity, do you mean instance?
10:29 AM
fikka
FunkyBob: yes
10:29 AM
FunkyBob
yes, that would be how I'd iterat the m2m in the template
10:30 AM
FunkyBob brain is still a little fuzzy from training
10:31 AM
jezeniel joined the channel
10:31 AM
empedokles78
10:34 AM
what is eg names?
10:34 AM
fikka
empedokles78: you have to iterate over {{ org.companies }}
10:34 AM
or provide a model method that does that for you
10:34 AM
mj_k joined the channel
10:35 AM
ok so it can be like {% for comp in org.companies %} {{ comp.name }} {% endfor %}
10:36 AM
FunkyBob
org.companies.all
10:36 AM
fikka
yeah.
10:36 AM
FunkyBob
it's still a to-many relation
10:37 AM
jas02 joined the channel
10:39 AM
swalladge__ is now known as swalladge
10:43 AM
empedokles78
Thanks, that works. Why is .all needed?
10:43 AM
kezabelle
because .companies returns a Manager, and .all (and most other manager methods) yield a queryset
10:44 AM
jas02 has quit
10:44 AM
fikka
empedokles78: yes, its like .objects, but for relations (RelatedManager)
10:44 AM
czart__ has quit
10:44 AM
jas02 joined the channel
10:44 AM
Leeds joined the channel
10:45 AM
czart joined the channel
10:46 AM
skali joined the channel
10:46 AM
empedokles78
How would a solution over a model method look like? What is to prefer?
10:48 AM
fikka
empedokles78: I guess it depends on how many times you want to reuse this behavior, so that you dont need to do all the for looping in the template.
10:48 AM
jas02 has quit
10:48 AM
empedokles78: you can define a method on the model class that returns the list of names
10:48 AM
jas02 joined the channel
10:49 AM
mj_k has quit
10:49 AM
empedokles78
I see, so this list then would be passed with the model instance to the template?
10:51 AM
skali has quit
10:51 AM
Haudegen has quit
10:52 AM
fikka
10:52 AM
something like this
10:53 AM
so the model does the for looping and you have a nice uniform way of representing the company names in each place you want to
10:55 AM
sol1x has quit
10:57 AM
redir joined the channel
10:58 AM
mj_k joined the channel
11:01 AM
skali joined the channel
11:02 AM
empedokles78
fikka, interesting, but I need to include a link to their pk in the template with {% url tag %}.
11:02 AM
Silvering joined the channel
11:06 AM
skali has quit
11:07 AM
zopsi joined the channel
11:09 AM
ran8888
hello ppl i download css tampelas but its dont read the fonts what the problem ?
11:10 AM
11:14 AM
kezabelle
show code. I'd guess you opened your script tag with ' but closed it with ", maybe?
11:14 AM
cebor has quit
11:15 AM
chasonchaffin has quit
11:16 AM
cebor joined the channel
11:16 AM
ran8888
no its ok....its big tampeles and i dont know what show you ....if the problem in html or js ?
11:19 AM
kezabelle:
11:19 AM
linurandy_ joined the channel
11:20 AM
jas02 has quit
11:20 AM
jas02 joined the channel
11:21 AM
Nizumzen has quit
11:22 AM
_heena_py_ joined the channel
11:22 AM
jtiai
ran8888: Where your bootstrap files are actually located?
11:23 AM
ran8888: and how you load for example bootstrap.js in your template? Can you paste that part?
11:23 AM
ran8888
jtiai: in static folder
11:23 AM
the css its read
11:24 AM
mj_k has quit
11:24 AM
jtiai
ran8888: Well your template has something broken. Without seeing hard to tell anything beyond what kezabelle said.
11:24 AM
skali joined the channel
11:26 AM
rahulch has quit
11:26 AM
arielfe1984 joined the channel
11:26 AM
ran8888: So somewhere in your template you have something like <script href="{% static "js/bootsrap.js" %}" ></script> (or close to it) most probably you're missing closing quote.
11:28 AM
eperzhand joined the channel
11:28 AM
bahamas has quit
11:29 AM
skali has quit
11:30 AM
ran8888
jtiai: i cheack all....
11:33 AM
sarp has quit
11:33 AM
greg_f has quit
11:33 AM
shangxiao has quit