Django create several container columns in a template and fill it with several values from QuerySet

I’m pretty a newbie in Web-Development, so I’ve met some difficulties while trying to connect html-templates with Django code.
My plan for a certain page of my projected site is roughly to have a header on above, then lower there are 3 column-shaped containers (left to right, representing, i.e., different groups) filled with names of members of those groups (with vertical alignment, each member in a separate little container with photo, name and description).
I thought that, as I use Django, it would be stupid to hard-code all the members into containers, and there probably are some methods to fill those columns from the code. I used cycles.
Here is the template (“core” is a name of the app, templates are located in project/core/templates/core directory):

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
<code>{% extends 'core/base.html' %}
{% block content %}
<h1>{{title}}</h1>
<div>Characters</div>
<div>
{% for fac in factions %}
{% if fac == outers %}
<div>
<h2>{{fac}}</h2>
{% for char in fac %}
<div>
<h3>{{char.name}}</h3>
<h3>{{char.description}}</h3>
</div>
{% endfor %}
</div>
{% endif %}
{% if fac == resistance %}
...
{% endfor %}
</div>
{% endblock %}
</code>
<code>{% extends 'core/base.html' %} {% block content %} <h1>{{title}}</h1> <div>Characters</div> <div> {% for fac in factions %} {% if fac == outers %} <div> <h2>{{fac}}</h2> {% for char in fac %} <div> <h3>{{char.name}}</h3> <h3>{{char.description}}</h3> </div> {% endfor %} </div> {% endif %} {% if fac == resistance %} ... {% endfor %} </div> {% endblock %} </code>
{% extends 'core/base.html' %}

{% block content %}
<h1>{{title}}</h1>
<div>Characters</div>
<div>
  {% for fac in factions %}
    {% if fac == outers %}
      <div>
        <h2>{{fac}}</h2>
        {% for char in fac %}
          <div>
            <h3>{{char.name}}</h3>
            <h3>{{char.description}}</h3>
          </div>
        {% endfor %}
      </div>
    {% endif %}
    {% if fac == resistance %}
      ...
  {% endfor %}
</div>
{% endblock %}

File core/models.py:

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
<code>class Character(models.Model):
FACTION_CHOICES = (
('outers', 'Outer World'),
('resistance', 'Resistance'),
('neutrals', 'Neutral characters'),
)
name = models.CharField(max_length=100)
slug = models.SlugField(max_length=255, blank=True, db_index=True, default='')
faction = models.CharField('Faction', max_length=100, choices=FACTION_CHOICES, default='neutrals')
description = models.TextField(blank=True)
content = models.TextField(blank=True)
photo = models.ImageField(upload_to="photos/%Y/%m/%d/", blank=True)
time_create = models.DateTimeField(auto_now_add=True)
time_update = models.DateTimeField(auto_now=True)
objects = models.Manager()
def __str__(self):
return self.name
class Meta:
ordering = ['-time_create']
indexes = [models.Index(fields=['-time_create'])]
</code>
<code>class Character(models.Model): FACTION_CHOICES = ( ('outers', 'Outer World'), ('resistance', 'Resistance'), ('neutrals', 'Neutral characters'), ) name = models.CharField(max_length=100) slug = models.SlugField(max_length=255, blank=True, db_index=True, default='') faction = models.CharField('Faction', max_length=100, choices=FACTION_CHOICES, default='neutrals') description = models.TextField(blank=True) content = models.TextField(blank=True) photo = models.ImageField(upload_to="photos/%Y/%m/%d/", blank=True) time_create = models.DateTimeField(auto_now_add=True) time_update = models.DateTimeField(auto_now=True) objects = models.Manager() def __str__(self): return self.name class Meta: ordering = ['-time_create'] indexes = [models.Index(fields=['-time_create'])] </code>
class Character(models.Model):

    FACTION_CHOICES = (
        ('outers', 'Outer World'),
        ('resistance', 'Resistance'),
        ('neutrals', 'Neutral characters'),
    )

    name = models.CharField(max_length=100)
    slug = models.SlugField(max_length=255, blank=True, db_index=True, default='')
    faction = models.CharField('Faction', max_length=100, choices=FACTION_CHOICES, default='neutrals')
    description = models.TextField(blank=True)
    content = models.TextField(blank=True)
    photo = models.ImageField(upload_to="photos/%Y/%m/%d/", blank=True)
    time_create = models.DateTimeField(auto_now_add=True)
    time_update = models.DateTimeField(auto_now=True)
    objects = models.Manager()

    def __str__(self):
        return self.name

    class Meta:
        ordering = ['-time_create']
        indexes = [models.Index(fields=['-time_create'])]

The corresponding view from core/views.py:

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
<code><...>
def characters(request):
chars = Character.objects.all()
faction_outers = Character.objects.filter(faction='outers')
faction_resistance = Character.objects.filter(faction='resistance')
faction_neutrals = Character.objects.filter(faction='neutrals')
factions = [faction_outers, faction_resistance, faction_neutrals]
data = {'title': "Characters", 'menu': menu, 'characters': chars, 'factions': factions}
return render(request, 'core/chars.html', context=data)
</code>
<code><...> def characters(request): chars = Character.objects.all() faction_outers = Character.objects.filter(faction='outers') faction_resistance = Character.objects.filter(faction='resistance') faction_neutrals = Character.objects.filter(faction='neutrals') factions = [faction_outers, faction_resistance, faction_neutrals] data = {'title': "Characters", 'menu': menu, 'characters': chars, 'factions': factions} return render(request, 'core/chars.html', context=data) </code>
<...>
def characters(request):
    chars = Character.objects.all()
    faction_outers = Character.objects.filter(faction='outers')
    faction_resistance = Character.objects.filter(faction='resistance')
    faction_neutrals = Character.objects.filter(faction='neutrals')
    factions = [faction_outers, faction_resistance, faction_neutrals]
    data = {'title': "Characters", 'menu': menu, 'characters': chars, 'factions': factions}
    return render(request, 'core/chars.html', context=data)

The separation of groups in several variables was made as the function regroup in the template wasn’t helpful, and I thought that problem is in functioning of regroup. But the method above didn’t help as well. Test server page in a browser shows in its code <div> " " == $0 </div> on the place where the list of members must be located.
So, my question is – is there an opportunity to create and fill those container columns by cycles with data from QuerySets, and if there is, can you explain me how to do it properly?
If any additional info is necessary, I’m ready to provide it. Thanks a lot for your advices in advance.

Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa Dịch vụ tổ chức sự kiện 5 sao Thông tin về chúng tôi Dịch vụ sinh nhật bé trai Dịch vụ sinh nhật bé gái Sự kiện trọn gói Các tiết mục giải trí Dịch vụ bổ trợ Tiệc cưới sang trọng Dịch vụ khai trương Tư vấn tổ chức sự kiện Hình ảnh sự kiện Cập nhật tin tức Liên hệ ngay Thuê chú hề chuyên nghiệp Tiệc tất niên cho công ty Trang trí tiệc cuối năm Tiệc tất niên độc đáo Sinh nhật bé Hải Đăng Sinh nhật đáng yêu bé Khánh Vân Sinh nhật sang trọng Bích Ngân Tiệc sinh nhật bé Thanh Trang Dịch vụ ông già Noel Xiếc thú vui nhộn Biểu diễn xiếc quay đĩa Dịch vụ tổ chức tiệc uy tín Khám phá dịch vụ của chúng tôi Tiệc sinh nhật cho bé trai Trang trí tiệc cho bé gái Gói sự kiện chuyên nghiệp Chương trình giải trí hấp dẫn Dịch vụ hỗ trợ sự kiện Trang trí tiệc cưới đẹp Khởi đầu thành công với khai trương Chuyên gia tư vấn sự kiện Xem ảnh các sự kiện đẹp Tin mới về sự kiện Kết nối với đội ngũ chuyên gia Chú hề vui nhộn cho tiệc sinh nhật Ý tưởng tiệc cuối năm Tất niên độc đáo Trang trí tiệc hiện đại Tổ chức sinh nhật cho Hải Đăng Sinh nhật độc quyền Khánh Vân Phong cách tiệc Bích Ngân Trang trí tiệc bé Thanh Trang Thuê dịch vụ ông già Noel chuyên nghiệp Xem xiếc khỉ đặc sắc Xiếc quay đĩa thú vị
Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa
Thiết kế website Thiết kế website Thiết kế website Cách kháng tài khoản quảng cáo Mua bán Fanpage Facebook Dịch vụ SEO Tổ chức sinh nhật