Re: [mezzanine-users] Re: Issues Getting Category

2015-11-27 Thread Nkansah Rexford
Its not showing up, because your if statement evaluates to false. It 
doesn't know of ANY string "news" in the template. Thus, it'll always 
evaluate to false.

I guess your issues are more of getting fundamentals with django, than has 
to do with mezzanine!

On Friday, November 27, 2015 at 4:32:45 PM UTC, R.J. Jackson wrote:
>
> However if I don't put the if category == "news" part of it, it does show 
> up fine. 
>
> On Friday, November 27, 2015 at 10:14:10 AM UTC-5, R.J. Jackson wrote:
>>
>> Like I said I have tried working with tags and it doesn't work.  This is 
>> the code I had.
>>
>> {% with x.categories.all as categories %}
>> {% if categories %}
>> {% for category in categories %}
>> {% if category == "news" %}
>> {{category}}
>> {% endif %}
>> {% endfor %}
>>
>> On Thursday, November 26, 2015 at 4:03:21 PM UTC-5, Danny S wrote:
>>>
>>> On 27/11/2015 4:33 AM, R.J. Jackson wrote:
>>>
>>> Hi, thank you it was helpful. 
>>>
>>> I have a follow up question, lets say I wanted to do a check to see if 
>>> category is == to a string, how can I do that?
>>>
>>>
>>> Why  not read up on Django template tags? 
>>> https://docs.djangoproject.com/en/1.8/ref/templates/builtins/#if
>>>
>>> There's several examples there using both == and %ifequal, see which one 
>>> works best for you.
>>>
>>> Seeya. Danny.
>>>
>>>
>>> I have tried using the if tag but it doesn't work.
>>>
>>> On Wednesday, November 25, 2015 at 6:09:42 PM UTC-5, Nkansah Rexford 
>>> wrote: 

 Perhaps the blog_post_list.html file might be of help. In mine, I find 
 this: 
 {% with blog_post.categories.all as categories %}
   {% if categories %}
 ...
 {% for category in categories %}
 {{ 
 category }}{% if not forloop.last %}, {% endif %}
 {% endfor %}
   {% endif %}
 {% endwith %}

 That hopefully gives an idea how to fetch a category.

 And remember, you wouldn't expect to find a category object or objects 
 if one isn't already created.

>>> -- 
>>> You received this message because you are subscribed to the Google 
>>> Groups "Mezzanine Users" group.
>>> To unsubscribe from this group and stop receiving emails from it, send 
>>> an email to mezzanine-use...@googlegroups.com.
>>> For more options, visit https://groups.google.com/d/optout.
>>>
>>>
>>>
>>>

-- 
You received this message because you are subscribed to the Google Groups 
"Mezzanine Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to mezzanine-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [mezzanine-users] Re: Issues Getting Category

2015-11-27 Thread R.J. Jackson
Just in case anyone had the same issue I had to call the category title 
attribute.

On Friday, November 27, 2015 at 11:32:45 AM UTC-5, R.J. Jackson wrote:
>
> However if I don't put the if category == "news" part of it, it does show 
> up fine. 
>
> On Friday, November 27, 2015 at 10:14:10 AM UTC-5, R.J. Jackson wrote:
>>
>> Like I said I have tried working with tags and it doesn't work.  This is 
>> the code I had.
>>
>> {% with x.categories.all as categories %}
>> {% if categories %}
>> {% for category in categories %}
>> {% if category == "news" %}
>> {{category}}
>> {% endif %}
>> {% endfor %}
>>
>> On Thursday, November 26, 2015 at 4:03:21 PM UTC-5, Danny S wrote:
>>>
>>> On 27/11/2015 4:33 AM, R.J. Jackson wrote:
>>>
>>> Hi, thank you it was helpful. 
>>>
>>> I have a follow up question, lets say I wanted to do a check to see if 
>>> category is == to a string, how can I do that?
>>>
>>>
>>> Why  not read up on Django template tags? 
>>> https://docs.djangoproject.com/en/1.8/ref/templates/builtins/#if
>>>
>>> There's several examples there using both == and %ifequal, see which one 
>>> works best for you.
>>>
>>> Seeya. Danny.
>>>
>>>
>>> I have tried using the if tag but it doesn't work.
>>>
>>> On Wednesday, November 25, 2015 at 6:09:42 PM UTC-5, Nkansah Rexford 
>>> wrote: 

 Perhaps the blog_post_list.html file might be of help. In mine, I find 
 this: 
 {% with blog_post.categories.all as categories %}
   {% if categories %}
 ...
 {% for category in categories %}
 {{ 
 category }}{% if not forloop.last %}, {% endif %}
 {% endfor %}
   {% endif %}
 {% endwith %}

 That hopefully gives an idea how to fetch a category.

 And remember, you wouldn't expect to find a category object or objects 
 if one isn't already created.

>>> -- 
>>> You received this message because you are subscribed to the Google 
>>> Groups "Mezzanine Users" group.
>>> To unsubscribe from this group and stop receiving emails from it, send 
>>> an email to mezzanine-use...@googlegroups.com.
>>> For more options, visit https://groups.google.com/d/optout.
>>>
>>>
>>>
>>>

-- 
You received this message because you are subscribed to the Google Groups 
"Mezzanine Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to mezzanine-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [mezzanine-users] Re: Issues Getting Category

2015-11-27 Thread R.J. Jackson
Like I said I have tried working with tags and it doesn't work.  This is 
the code I had.

{% with x.categories.all as categories %}
{% if categories %}
{% for category in categories %}
{% if category == "news" %}
{{category}}
{% endif %}
{% endfor %}

On Thursday, November 26, 2015 at 4:03:21 PM UTC-5, Danny S wrote:
>
> On 27/11/2015 4:33 AM, R.J. Jackson wrote:
>
> Hi, thank you it was helpful. 
>
> I have a follow up question, lets say I wanted to do a check to see if 
> category is == to a string, how can I do that?
>
>
> Why  not read up on Django template tags? 
> https://docs.djangoproject.com/en/1.8/ref/templates/builtins/#if
>
> There's several examples there using both == and %ifequal, see which one 
> works best for you.
>
> Seeya. Danny.
>
>
> I have tried using the if tag but it doesn't work.
>
> On Wednesday, November 25, 2015 at 6:09:42 PM UTC-5, Nkansah Rexford 
> wrote: 
>>
>> Perhaps the blog_post_list.html file might be of help. In mine, I find 
>> this: 
>> {% with blog_post.categories.all as categories %}
>>   {% if categories %}
>> ...
>> {% for category in categories %}
>> {{ 
>> category }}{% if not forloop.last %}, {% endif %}
>> {% endfor %}
>>   {% endif %}
>> {% endwith %}
>>
>> That hopefully gives an idea how to fetch a category.
>>
>> And remember, you wouldn't expect to find a category object or objects if 
>> one isn't already created.
>>
> -- 
> You received this message because you are subscribed to the Google Groups 
> "Mezzanine Users" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to mezzanine-use...@googlegroups.com .
> For more options, visit https://groups.google.com/d/optout.
>
>
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Mezzanine Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to mezzanine-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[mezzanine-users] Re: Issues Getting Category

2015-11-26 Thread R.J. Jackson
Hi, thank you it was helpful.

I have a follow up question, lets say I wanted to do a check to see if 
category is == to a string, how can I do that?

I have tried using the if tag but it doesn't work.

On Wednesday, November 25, 2015 at 6:09:42 PM UTC-5, Nkansah Rexford wrote:
>
> Perhaps the blog_post_list.html file might be of help. In mine, I find 
> this:
> {% with blog_post.categories.all as categories %}
>   {% if categories %}
> ...
> {% for category in categories %}
> {{ 
> category }}{% if not forloop.last %}, {% endif %}
> {% endfor %}
>   {% endif %}
> {% endwith %}
>
> That hopefully gives an idea how to fetch a category.
>
> And remember, you wouldn't expect to find a category object or objects if 
> one isn't already created.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Mezzanine Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to mezzanine-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [mezzanine-users] Re: Issues Getting Category

2015-11-26 Thread Danny

On 27/11/2015 4:33 AM, R.J. Jackson wrote:

Hi, thank you it was helpful.

I have a follow up question, lets say I wanted to do a check to see if 
category is == to a string, how can I do that?


Why  not read up on Django template tags?
https://docs.djangoproject.com/en/1.8/ref/templates/builtins/#if

There's several examples there using both == and %ifequal, see which one 
works best for you.


Seeya. Danny.



I have tried using the if tag but it doesn't work.

On Wednesday, November 25, 2015 at 6:09:42 PM UTC-5, Nkansah Rexford 
wrote:


Perhaps the blog_post_list.html file might be of help. In mine, I
find this:
|
{% with blog_post.categories.all as categories %}
  {% if categories %}
...
{% for category in categories %}
{{
category }}{% if not forloop.last %}, {% endif %}
{% endfor %}
  {% endif %}
{% endwith %}
|

That hopefully gives an idea how to fetch a category.

And remember, you wouldn't expect to find a category object or
objects if one isn't already created.

--
You received this message because you are subscribed to the Google 
Groups "Mezzanine Users" group.
To unsubscribe from this group and stop receiving emails from it, send 
an email to mezzanine-users+unsubscr...@googlegroups.com 
.

For more options, visit https://groups.google.com/d/optout.



--
You received this message because you are subscribed to the Google Groups "Mezzanine 
Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to mezzanine-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[mezzanine-users] Re: Issues Getting Category

2015-11-25 Thread Nkansah Rexford
Perhaps the blog_post_list.html file might be of help. In mine, I find this:
{% with blog_post.categories.all as categories %}
  {% if categories %}
...
{% for category in categories %}
{{ category 
}}{% if not forloop.last %}, {% endif %}
{% endfor %}
  {% endif %}
{% endwith %}

That hopefully gives an idea how to fetch a category.

And remember, you wouldn't expect to find a category object or objects if 
one isn't already created.

-- 
You received this message because you are subscribed to the Google Groups 
"Mezzanine Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to mezzanine-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.