Questions tagged [django-intermediate-table]

12 questions
3
votes
1 answer

Django Attribute Error: object has not attribute 'forms'

I have a model formset of an intermediate model that I am using to assign users to another model. When I try to generate the view I get 'StaffAssignmentForm' object has no attribute 'forms'. Model class StaffAssignment(models.Model): study =…
Rileywiley
  • 139
  • 11
2
votes
1 answer

Django intermediate table with a many-to-many field instead foreign key?

I have 2 models in my application: User Tower My goal is to associate many towers to a user using an intermediate table because I need to add a period of time. So I have something like this in my models: class Tower(models.Model): name =…
2
votes
1 answer

how to correctly assign the through attribute in django?

I was just looking the documentation to be able to change the intermediate table but when I implement it, I get into trouble: https://docs.djangoproject.com/en/2.0/topics/db/models/#extra-fields-on-many-to-many-relationships The problem as such is…
2
votes
1 answer

QuerySet order_by intermediate models

I'm trying to create a intermediate model with the created field recording the time of following relationship. The models is as following: class Profile(models.Model): user = models.OneToOneField(User, related_name='profile') realname =…
2
votes
1 answer

Django - How to build an intermediate m2m model that fits? / best practice

First of all I have to admit that I'm quite new to all this coding stuff but as I couldn't find a proper solution doing it myself and learning to code is probably the best way. Anyway, I'm trying to build an app to show different titleholders,…
1
vote
2 answers

Django: ManyToManyField with intermediary model error

Django is not managing our databases for us, therefor I created the table RulesetRuleMap to handle the ManyToMany relationship between Ruleset and Rule: Each Ruleset can consist of multiple Rules and each Rule can be used in multiple…
0
votes
1 answer

How to create a relation to intermediate table using Model in Django?

Could anyone help me create this database using the ORM model in Django? I'm stuck at creating a relation between the ATTENDANCE and CLASSDETAIL table. Please look at this ERD:
0
votes
1 answer

Django ORM for intermediate images table gives error "The QuerySet value for an exact lookup must be limited to one result"

I have multiple Images associated with a Spots using the intermediate table ImageSpots, and I am trying to render each image for each spot but keep getting the error "The QuerySet value for an exact lookup must be limited to one result using…
0
votes
1 answer

Django M2M Relationship Issue with Admin Using Intermediate Table with Multiselect

I'm working with m2m relationships using through to set intermediate table. Issue is I need to show multiselection instead of a normal dorpdown but when I select multiple items and save I get an error. ValueError: Cannot assign "
0
votes
1 answer

Django: How do I create a view to update multiple records on an intermediate model with a Many-to-Many-through relationship?

I am a beginner to Django, and am creating an RSVP site to handle multiple events and keep track of guests to those events. I have a model for Guest, for Event, and an intermediate model for GuestEvent. I would like a page to loop through every…
0
votes
1 answer

How to select entire intermediate table in Django

In my database I have citations between objects as a ManyToMany field. Basically, every object can cite any other object. In Postgres, this has created an intermediate table. The table has about 12 million rows, each looks roughly like: id |…
mlissner
  • 17,359
  • 18
  • 106
  • 169
-1
votes
1 answer

proper way to set up many to many relation where intermediary field has foreign keys django

I have a custom user field and a permissions field in a django app. The documentation says the following: https://docs.djangoproject.com/en/2.0/ref/models/fields/#django.db.models.ManyToManyField I am also currently studying this article:…