Opened 6 years ago

Closed 6 years ago

#12316 closed (invalid)

GenericForeignKey produces an error when submitting from a form

Reported by: djansoft Owned by: nobody
Component: Uncategorized Version: 1.1-beta
Severity: Keywords:
Cc: Triage Stage: Unreviewed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: UI/UX:


I apologize for not making a better report, but I cannot afford the time right now to write the minimum amount of code to reproduce this.

Snippet from my

class Subscription(models.Model):
    user = models.OneToOneField(User, primary_key=True)
    promotion = models.ForeignKey(Promotion)
    start_date = models.DateTimeField(auto_now_add=True)
    # Foreign key to AuthorizeNetSubscription u other model
    payment_gateway_subscription = generic.GenericForeignKey()
    is_active = models.BooleanField(default=True)

class AuthorizeNetSubscription(models.Model):
    subscription_id = models.CharField('subscriptionId in the ARB API call return', 
            max_length=16, primary_key=True)

Snippet from my

        authorize_net_subscription = AuthorizeNetSubscription(
        user = User.objects.create_user(
            username = form_list[1].cleaned_data['display_name'],
        subscription = Subscription(

It fails in the line that creates the Subscription instance with a TypeError exception "'object_id' is an invalid keyword argument for this function" coming from line 320 in django/db/models/

Change History (1)

comment:1 Changed 6 years ago by kmtracey

  • Needs documentation unset
  • Needs tests unset
  • Patch needs improvement unset
  • Resolution set to invalid
  • Status changed from new to closed

You appear to have skipped steps 1 and 2 listed here:

Step 3 alone is not all you need in your model to have a working GenericForeignKey, you need to include 1 and 2 as well.

Note: See TracTickets for help on using tickets.
Back to Top