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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T03:17:02+00:00 2026-05-28T03:17:02+00:00

I have a view that uses one of the class-based generic views (derives from

  • 0

I have a view that uses one of the class-based generic views (derives from django.views.generic.DetailView), with a custom form:

from django.views.generic import DetailView

class MyDetailView(DetailView):
    model=MyModel

    def get_object(self):
        object = MyModel.objects.get(uuid=self.kwargs['uuid'])

    def get_context_data(self, **kwargs):
        form = MyForm
        context = super(MyDetailView, self).get_context_data(**kwargs)
        context['form'] = form
        return context

I’d like the POST for the form submission to go to the same URL as the GET. Is it possible to modify this view code so that it can also respond to the POST? If so, how? Do I need to inherit from another mixin class? And what is the name of the method to add to process the form data?

Or is it just a bad idea to respond to the POST at the same URL for this scenario?

(Note: the form is not modifying the MyModel object being displayed. Instead, it’s being used to create a model object of a different type, so UpdateView isn’t reallya good fit).

  • 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-28T03:17:03+00:00Added an answer on May 28, 2026 at 3:17 am

    It’s not quite clear what you want to do with your POST request, but it might make sense to use django.views.generic.UpdateView instead of DetailView – as it also gives you some methods to deal with form processing.

    To just add handling of a POST request to the detail view a post() method should be enough!

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

Sidebar

Related Questions

I have a custom view in my Android App that uses a ScaleGestureDetector.SimpleOnScaleGestureListener to
I have a view model that is displayed in a view that uses uploadify.
I have a partial view that uses a Telerik MVC Grid, and it has
I have used a list view that uses a grid view in WPF. I
I have a controller's action and view page that uses a master page. The
I have a website that uses JSP as its view technology (and Spring MVC
I have an SQL Server Reporting Services (SSRS) report, that uses a view. That
We have an app that uses simple one way binding with a GridView to
I have rails application that has two view ports that uses the same data.
I have a Player class that uses a ForeignKey to a Photo object for

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.