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 8145575
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T13:42:20+00:00 2026-06-06T13:42:20+00:00

I have a Model which has some constants defined, like below: class Order(models.Model): WAITING

  • 0

I have a Model which has some constants defined, like below:

class Order(models.Model):
    WAITING = 0
    APPROVED = 1
    DISAPPROVED =2

I want to display some conditional tags in my template, for example, showing an hourglass icon if the displayed Order has the status of WAITING.

Currently I’m doing it like below, but I don’t like it because that way, I need to keep track of values of every constants:

{% if order.status == 0 %}
    your order is waiting approval.
{% endif

How can I access Order.WAITING, Order.APPROVED and Order.DISAPPROVED constants from my templates? What is the correct way of what I want to achieve?

  • 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-06T13:42:21+00:00Added an answer on June 6, 2026 at 1:42 pm

    Presumably order is an instance of Order, so it has access to the class constants already. So this would work:

    if order.status == order.WAITING
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a model which has a certain behaviour implemented. class X { ....
I have a model called Contact which has_one guest like so. class Contact <
I have a model which has some double properties on it, and with them
I have an entity model which has some tables added from my DB. I
I have wrote a class (a snippet is below) which have some data members
I have a QTableView which has some QString based items in its model. I
I have model Foo which has field bar. The bar field should be unique,
I'm using ASP.NET MVC and have a model which has an image (byte array)
I have an Entry model which has many Tag s. Tag s are added
I have a Ticket model which has_many :tags . I would like to find

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.