Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8490105
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T22:01:05+00:00 2026-06-10T22:01:05+00:00

Right now I have a loop in the view that displays a brief description

  • 0

Right now I have a loop in the view that displays a brief description of topics:

example code:

        <div id="menu">
            <ul>
                {% for item in topics %}
                <li>
                    <img src="img/{{item.name}}_ico.png" alt="{{item.name}}" />
                    <h2>{{item.heading}}</h2>
                    <p>{{ item.detail|safe }}</p>
                </li>
                {% endfor %}
            </ul>
        </div>

The above code displays an icon – a heading and some text for several items.

Since these topics never change and are only updated by the devs, I created a dictionary in the controller that contains all this content..

   topics= [
                    {'name': 'alert',
                     'heading': "Maintain attention",
                     'detail': 'Keep your students involved, alert and attentive during class with closed questions about the current subject.'},
                    {'name': 'time',
                     'heading': 'Instant feedback',
                     'detail': 'Save precious time and avoid checking quizzes!<br />studyWise&copy; check them instantly, providing you with results.'},
                    {'name': 'reward',
                     'heading': "Reward students",
                     'detail': 'Motivate students to participate and learn by rewarding good work with positive feedback.'},
                    {'name': 'money',
                     'heading': 'Save on expenses!',
                     'detail': 'Why spend money buying similar gadgets or subscriptions?<br />Use studyWise&copy; free of charge now.'},
                    {'name': 'cell',
                     'heading': 'Accessible',
                     'detail': 'Works with any smartphone, laptop or tablet.<br />No installation required.'},
                    {'name': 'share',
                     'heading': 'Share with colleagues',
                     'detail': 'Share topics, quizes or course statistics with colleagues.<br />See how your assistants are doing.'},
                    {'name': 'statistics',
                     'heading': 'Statistics',
                     'detail': 'Get helpful info about your students understanding of the learning material today.'}
                ]

What I am wanting to do is adhere to MVC principles and keep the code clean.
Should I move this dictionary to a ‘model’ file?
Will that affect performance?

Thanks

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-10T22:01:06+00:00Added an answer on June 10, 2026 at 10:01 pm

    These topics should be database records and you should just query them when you want to use them. Depending on the framework you are using, you might not even have to change your template.

    In Django you would have :

    #models.py
    from django.db import models
    
    class Topic(models.Model):
        name = models.CharField(...)
        heading = models.CharField(...)
        detail = models.TextField()
    
    #views.py
    from myapp.models import Topic
    
    # In your view:
        topics = Topic.objects.all()
    

    Whether they change often or not doesn’t matter in that regard.

    I honestly think that the performance impact is not a concern you should have here.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Right now I have a foreach loop that grabs the first link with an
Right now I have a link that causes a hidden div to appear when
Right now I have an UITableViewController that displays a set of Artist objects sorted
Right now, I have a do loop for a task model in my view:
Right now I have a script that will get the last five files in
Right now I have a function, in a class that is used to listen
Right now I have a PHP file that does a MYSQL query and then
I need help with this loop through an array. Right now I have 3
Right now I have this code: int number = 0; DirectoryInfo di = new
Good day! I right now have a function the drags an element from a

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.