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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T16:29:22+00:00 2026-05-27T16:29:22+00:00

I have users creating lists in my site and I’m using the generic CreateView

  • 0

I have users creating lists in my site and I’m using the generic CreateView to allow them create them. One of the fields of a list is the owner (who creates it).

It does not make sense to ask users to select the owner, since the user that is creating it is already the owner.

So, I’m passing to the CreateView a “form_class” instead of a “model” parameter where the form_class excludes the owner field.

In order to save the form, I need to add the owner to it.

I subclassed CreateView and added a form_valid method, but I’m having problems doing this.

So far, I got

class MyCreateView(CreateView)
    form_class = ListForm

def form_valid(self, form):
    form.??? = self.request.user -->> expression of the left side
    return super(MyCreateView, self).form_valid(form)

It should be something simple. In this thread, they say to use self.object.owner, but self.object is a None type.

How should I handle this?
Thanks

  • 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-27T16:29:22+00:00Added an answer on May 27, 2026 at 4:29 pm

    You’re looking for form.instance.owner = request.user and then call super

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

Sidebar

Related Questions

On my site I allow users to authenticate via creating an account with my
I have users who are using secure-wave security. Evidently it is some sort of
We frequently have users that create multiple accounts and then end up storing the
I am creating an admin menu for a site and I have several drop
I am creating a site where each registered user can store a list of
My little site should be pooling list of items from a table using the
I am creating an app for uploading and sharing files between users. I have
I'm currently creating a small todo site, and I have multiple questions related to
When creating a web application, and lets say you have a User object denoting
When creating scrollable user controls with .NET and WinForms I have repeatedly encountered situations

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.