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

  • Home
  • SEARCH
  • 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 957133
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T00:39:06+00:00 2026-05-16T00:39:06+00:00

Must be simple solution. But I do not see it. Please help me. Looks

  • 0

Must be simple solution. But I do not see it. Please help me. Looks like ‘gorod’ is in request but when i trying cleaned_data() it gives me KeyError

KeyError at /ticket/

'gorod'

Request Method:     POST
Request URL:    http://localhost:8000/ticket/
Exception Type:     KeyError
Exception Value:    

'gorod'

Exception Location:     C:\Documents and Settings\POLINOM\web\website\orders\views.py in SaveOrder2, line 93
Python Executable:  C:\Python26\python.exe
Python Version:     2.6.5


Traceback:
File "C:\Python26\lib\site-packages\django\core\handlers\base.py" in get_response
  92.                 response = callback(request, *callback_args, **callback_kwargs)
File "C:\Documents and Settings\POLINOM\web\website\orders\views.py" in ticket
  136.             adr_form=MakeForm2(request)
File "C:\Documents and Settings\POLINOM\web\website\orders\views.py" in MakeForm2
  58.             SaveOrder2(request,form)
File "C:\Documents and Settings\POLINOM\web\website\orders\views.py" in SaveOrder2
  95.     gorod=form.cleaned_data['gorod']

Exception Type: KeyError at /ticket/
Exception Value: 'gorod'

My form:

class MumForm(AddressForm):
    CITY_CHOICES = (
                    (0,'August,11 - Washington, BlackCat'),
                    (1,'August,12 - Philadelphia, WorldLiveCafe'),
                    (2,'August,13 - New York, Irving Plaza'),
                    (3,'August,14 - Boston, Middle East'),
                    (4,'August,15 - Montreal, Cabaret Du Musee Juste Pour Rire'),
                    (5,'August,16 - Toronto, Mod club'),
                    (6,'August,17 - Cleveland, Beachland Tavern'),
                    (7,'August,18 - ------------------------'),
                    (9,'August,19 - ------------------------'),
                    (10,'August,20 - Atlanta, Masquerade'),
                    (11,'August,22 - Chicago, Empty Bottle'),
                    (12,'August,23 - Milwaukee, Shank Hall'),
                    (13,'August,24 - Minneapolis, Varsity (promoted by 1st Avenue)'),
                    (14,'August,25 - Winnipeg, Cowboys'),
                    (15,'August,27 - Edmonton, The Starlite Room'),
                    (16,'August,28 - Calgary, The Den'),
                    (17,'August,29 - Vancouver, Commodore Ballroom'),
                    (18,"August,31 - Seattle, Neumo's"),

                    (19,'September,01 - Portland, Howthorne Theatre'),
                    (20,'September,02 - San Francisco, Bottom Of The Hill'),
                    (21,'September,03 - Los Angeles, The Roxy'),
                    (22,'September,04 - Salt Lake City, Urban Lounge'),
                    (23,'September,05 - Denver, Bluebird Theatre'),
                    (24,'September,06 - Kansas City, The Record Bar'),
                    (25,'September,07 - Dallas, The Loft'),
                    (26,"September,08 - Austin, Emo's"),
        )
    gorod = forms.ChoiceField(choices=CITY_CHOICES, label="Выберите город в котором вы хотите пойти на концерт")
    note = forms.CharField(max_length=1500,label=u'Заметка',widget=forms.Textarea)

This is inherits from ather form which is:

class AddressForm(forms.Form):
    address = forms.CharField(label=u"Адрес",max_length=200,required=True,widget=forms.TextInput(attrs={'size':60}))
    city = forms.CharField(label=u"Город",max_length=50,required=True)
    country = forms.ChoiceField(label=u"Страна",required=True,choices=COUNTRIES)
    state = forms.ChoiceField(label=u"Штат/Провинция",required=False, choices=StateProvince().get_all_states(), error_messages={'invalid_choice':u'нет среди допустимых значений. Пожалуйста, выберите правильный вариант'}) 
    zip = forms.CharField(label=u"Почтовый код",max_length=10,widget=forms.TextInput(attrs={'size':8}),required=True)
    phone_number = forms.CharField(label=u"Номер телефона",required=False)

there is two models which i’m working with:

class Order(models.Model):
    STATUS_CHOICES=[
                    (1, 'Send'),
                    (0, 'Not_send'),                    
                ]
    user=models.ForeignKey(User)
    product=models.ForeignKey(Product)
    status = models.CharField(max_length=1,choices=STATUS_CHOICES)
    country = models.CharField(max_length=2)
    state = models.CharField(max_length=50) 
    zip = models.CharField(max_length=10)
    city = models.CharField(max_length=50)
    street = models.CharField(max_length=200)
    phone=models.CharField(max_length=20)


    def __unicode__(self):
        return 'Order by ' + self.user

class TicketProp(models.Model):
    order=models.ForeignKey(Order)
    note=models.CharField(max_length=1500)
gorod=models.CharField(max_length=2)
  • 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-16T00:39:07+00:00Added an answer on May 16, 2026 at 12:39 am

    Maybe your AddressForm class is missing the gorod field? The form populates the .cleaned_data attribute (no () after the latter!-) based on the fields in the form; for example, in the source for the current django.forms, you’ll see on line 274

    for name, field in self.fields.items():
    

    and it’s in the body of the loop that the .cleaned_data dict is populated.

    So what’s your AddressForm code (and that of the model it presumably works with)…?

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

Sidebar

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.