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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T22:28:33+00:00 2026-05-16T22:28:33+00:00

I am trying to access data.get_age_display in my email template. I can’t seem to

  • 0

I am trying to access data.get_age_display in my email template. I can’t seem to get the display of this. I am not sure what I am doing wrong, I’ve using get_FIELD_display numerous times before but passed as context to a normal template. Is there something different with forms?

class RequestForm(forms.Form):

    ADULT = 1
    SENIOR = 2
    STUDENT = 3

    AGE_GROUP = (
        (ADULT, 'Adult'),
        (SENIOR, 'Senior'),
        (STUDENT, 'Student'),
    )


    name = forms.CharField(max_length=255)
    phone = forms.CharField(max_length=15)
    age = forms.ChoiceField(choices=AGE_GROUP)
    details = forms.CharField(widget=forms.Textarea())

    def save(self):
        order = Order(
            name = self.cleaned_data['name'],
            phone = self.cleaned_data['phone'],
            age = self.cleaned_data['age'],
            details = self.cleaned_data['details'],
        )
        order.save()

        template = loader.get_template('request_email.txt')

        # send over the order object in an email extracted so they can handle the ticket order
        context = Context({
            'data': order,
        })

        #import pdb; pdb.set_trace()

        email_subject = 'Request Tickets'
        mail_managers(email_subject, template.render(context))

in my request_email.txt all I am doing is {{ data.get_age_display }} any ideas?

Jeff

  • 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-05-16T22:28:33+00:00Added an answer on May 16, 2026 at 10:28 pm

    You haven’t shown the code for the Order model that you’re creating. Are you sure that the age field on the model has choices set?

    Any reason you’re not using a ModelForm? You’re creating an Order object within the form’s save() method, but not returning it. A modelform would do that for you, as well as removing the need to redeclare the fields for the form.

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

Sidebar

Related Questions

I'm using WSGI and trying to access the get/post data, using this code: import
I am not really sure how to get data out of this nested object
I'm trying to access fixture data in my RSpec tests but doesn't seem to
I am currently trying to access the data that was just inserted using: if($this->User->save($this->data))
When trying to access data-onload using $(#index).data(onload) I get back 'undefined' : <script type=text/html>
I am trying to get some data to display from an Array in Cakephp,
I'm trying to access list data using SSRS 2008. I have created an XML
I am trying to access all the data from database listOfFolder table folder and
I am trying to access my json data name on jsp page from android
I am trying to access the nsstring data out side the function and also

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.