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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T16:48:15+00:00 2026-06-18T16:48:15+00:00

I’m trying to subclass the base generic View object provided by Django so that

  • 0

I’m trying to subclass the base generic View object provided by Django so that I can control the rendering of the view fully but still use the cleaner class-based view method instead of mapping to a function.

This is my view so far:

from django.views.generic.base import View
from django.shortcuts import render
from account.forms import UserForm, UserProfileForm

class RegisterView(View):    
    def get(request, *args, **kwargs):

        user_form = UserForm()
        profile_form = UserProfileForm()

        return render(request, 'account/register.html', {'user_form': user_form, 'profile_form': profile_form})

    def post(request, *args, **kwargs):
        pass

When I try to navigate to the URL for this view I get this error from Django:

AttributeError at /account/register/

'RegisterView' object has no attribute 'META'

Request Method:     GET
Request URL:        http://localhost:8000/account/register/
Django Version:     1.4.3
Exception Type:     AttributeError
Exception Value:    'RegisterView' object has no attribute 'META'

Exception Location: C:\Python27\lib\site-packages\django\core\context_processors.py in debug, line 35
Python Executable:  C:\Python27\python.exe
Python Version:     2.7.3

Environment:


Request Method: GET
Request URL: http://localhost:8000/account/register/

Django Version: 1.4.3
Python Version: 2.7.3
Installed Applications:
('django.contrib.auth',
 'django.contrib.contenttypes',
 'django.contrib.sessions',
 'django.contrib.sites',
 'django.contrib.messages',
 'django.contrib.staticfiles',
 'django.contrib.admin',
 'account')

Installed Middleware:
('django.middleware.common.CommonMiddleware',
 'django.contrib.sessions.middleware.SessionMiddleware',
 'django.middleware.csrf.CsrfViewMiddleware',
 'django.contrib.auth.middleware.AuthenticationMiddleware',
 'django.contrib.messages.middleware.MessageMiddleware')


Traceback:
File "C:\Python27\lib\site-packages\django\core\handlers\base.py" in get_response
  111.                         response = callback(request, *callback_args, **callback_kwargs)
File "C:\Python27\lib\site-packages\django\views\generic\base.py" in view
  48.             return self.dispatch(request, *args, **kwargs)
File "C:\Python27\lib\site-packages\django\views\generic\base.py" in dispatch
  69.         return handler(request, *args, **kwargs)
File "C:\project\account\views.py" in get
  49.         return render(request, 'account/register.html', {'user_form': user_form, 'profile_form': profile_form})
File "C:\Python27\lib\site-packages\django\shortcuts\__init__.py" in render
  40.         context_instance = RequestContext(request, current_app=current_app)
File "C:\Python27\lib\site-packages\django\template\context.py" in __init__
  176.             self.update(processor(request))
File "C:\Python27\lib\site-packages\django\core\context_processors.py" in debug
  35.     if settings.DEBUG and request.META.get('REMOTE_ADDR') in settings.INTERNAL_IPS:

Exception Type: AttributeError at /account/register/
Exception Value: 'RegisterView' object has no attribute 'META'

The documentation doesn’t specify anything about any “META attribute” when subclassing generic views, so I’m not sure what I’m doing wrong or if this is even a permitted usage of the base generic view.

I’m a bit new to (serious) Python programming and to Django, so please forgive me if I’m missing something obvious about this.

  • 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-18T16:48:17+00:00Added an answer on June 18, 2026 at 4:48 pm

    Remember this is a class: you’ve missed the self argument in the definitions of get and post:

    def get(self, request, *args, **kwargs):
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a French site that I want to parse, but am running into
I'm parsing an RSS feed that has an ’ in it. SimpleXML turns this
I'm trying to convert HTML to plain text. I get many &\#8217; &\#8220; etc.
I'm trying to create an if statement in PHP that prevents a single post
I am trying to understand how to use SyndicationItem to display feed which is
Basically, what I'm trying to create is a page of div tags, each has
I'm new to using the Perl treebuilder module for HTML parsing and can't figure
I am trying to find ID3V2 tags from MP3 file using jid3lib in Java.
link Im having trouble converting the html entites into html characters, (&# 8217;) i
That's pretty much it. I'm using Nokogiri to scrape a web page what has

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.