python 2.7 - Django: QuerySet error -
I have a test scene where one of the data collection questions throws an error that I do not understand. I appreciate it if someone can comment on it and tell me in the right direction. This is my first project project and I am exceeding the learning curve, please bear with me:
Code:
biz_group = BusinessGroup.objects.get ( group_manager = user)) Group_team = BusinessGroupToTeams.objects.get (group_id = biz_group.group_id) which throws the error:
traceback (most recent Only call in the final): File "& lt; Console"; Line 1, & lt; Module & gt; File "/usr/lib/python2.7/dist-packages/django/db/models/manager.py", line 143, receive refund self.get_query_set (). Get (* args, ** kwargs) file "/ usr / lib / python2.7 / dist-packages / django / db / model / query.py", line 394, found in the num = len (clone) file "/ usr /lib/python2.7/dist-packages/django/db/models/query.py ", line 90, __len___self_come_cache = list (self.iterator ()) in the file" /usr/lib/python2.7/ Dist-packages / django / db / models / query "Py", line 301, in the compiler .results_iter () in the iterator for the line: file "/usr/lib/python2.7/dist-packages/django/db/ models / sql / compiler.py ", the rows in line 775, Self.execute_sql (Multi) in results_iter: file" /usr/lib/python2.7/dist-packages/django/db/models/sql/compiler. Py ", line 840, execute_sql in cursor.exact (sqa L, Parameter) file "/usr/lib/python2.7/dist-packages/django/db/backends/util.py", line 41, the returned file self.cursor.execute (sql, params) "/ usr / lib / Python2.7 / dist-packages / django / db / backends / postgresql_psycopg2 / base.py ", line 58, executed in six.rerai (utils.DatabaseError, utils.DatabaseError (* tuple (e.args)) , sys.exc_info () [2]) file "/usr/lib/python2.7/dist-packages/django/db/backends/postgresql_psycopg2 /base.py", line 54, perform back self.cursor.execute (in Query, args) database order: column businessgroup_to_teams.id does not exist LINE 1: SELECT "businessgroup_to_teams". " The business graphotypes model looks like this: Category BusinessAreaToTeams (models.Model): group_id = Model. Disimalfild (max_digits = 65535, decimal_places = 65535) team_id = model. Disimalfild (Adiktm_digits = 65535, Desial_pleses = 65535) class meta: db_table = 'businessgroup_to_teams' I do not question the "id" I am doing and there is no model field of "id". Can anyone explain why I am wrong here?
Ace That table with a crossover BusinessAreaToTeams . Group ID and instead of having Tim_aid when Dijhemlfild of raw ID, you group = foreign Cami (BUSINESS GROUP Team = External Cami (BusinessTem) # Model should be named after estimating This will create a group_ID and team_id field in your table, and you will find the connection between the use of digen's quarrets easily To manage Will allow. Please take a look at the introduction of this topic.
Comments
Post a Comment