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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 14, 20262026-05-14T02:15:09+00:00 2026-05-14T02:15:09+00:00

I have two models like this: class OptionsAndFeatures(models.Model): options = models.TextField(blank=True, null=True) entertainment =

  • 0

I have two models like this:

class OptionsAndFeatures(models.Model):
   options = models.TextField(blank=True, null=True)
   entertainment = models.TextField(blank=True, null=True)
   seats_trim = models.TextField(blank=True, null=True)
   convenience = models.TextField(blank=True, null=True)
   body_exterior = models.TextField(blank=True, null=True)
   lighting = models.TextField(blank=True, null=True)
   safety = models.TextField(blank=True, null=True)
   powertrain = models.TextField(blank=True, null=True)
   suspension_handling = models.TextField(blank=True, null=True)
   specs_dimensions = models.TextField(blank=True, null=True)
   offroad_capability = models.TextField(blank=True, null=True)
class Vehicle(models.Model):
   ...
   options_and_features = models.ForeignKey(OptionsAndFeatures, blank=True, null=True)

I have a model form for the OptionsAndFeaturesclass that I’m using in both the add and edit views. In the add view it works just fine. But the edit view renders the OptionsAndFeatures as blank. The code for the edit view is as follows:

def edit_vehicle(request, stock_number=None):   
   vehicle = get_object_or_404(Vehicle, stock_number=stock_number)

   if request.method == 'POST':
      # save info
   else:
       vehicle_form = VehicleForm(instance=vehicle)
       photos = PhotosFormSet(instance=vehicle)
       options = OptionsForm(instance=vehicle)

   #render_to_reponse

What could be the problem here?

  • 1 1 Answer
  • 3 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-14T02:15:10+00:00Added an answer on May 14, 2026 at 2:15 am

    You’re passing a Vehicle object in as the instance argument to a form presumably based on the OptionsAndFeatures class. This won’t work – obviously you’ll need an OptionsAndFeatures object.

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

Sidebar

Related Questions

I have two models like this: class ClassA(models.Model): ida = models.AutoField(primary_key=True) classb = models.ForeignKey(ClassB)
I have two models like this: class Store(models.Model): name = models.CharField(max_length=255) class Order(models.Model): store
I have two models like this: class A(models.Model): attachment = FileField(upload_to='a') class B(models.Model): attachment
I have two models: class Video(models.Model): slug = models.SlugField(blank=True, default='', db_index=True, unique=True) class VideoTranslation(models.Model):
Let's say I have two models looking like this: class ProductType(models.Model): product_type = models.CharField(max_length=100)
I have two models like so: class Visit(models.Model): id = models.AutoField(primary_key=True) name = models.CharField(max_length=65535,
I have two models like this: class Collar(models.Model): num_tags = models.BigIntegerField() class Dog(models.Model): num_legs
I have two models like this: class AA(models.Model): name = models.CharField() state = models.IngerField()
Django newbie here. I have two simple models like this: class Fluff(models.Model): # ....
I have a two models set up like this: class User < ActiveRecord::Base #

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.