Changes between Initial Version and Version 1 of Ticket #34168, comment 2


Ignore:
Timestamp:
Nov 21, 2022, 3:55:44 AM (2 years ago)
Author:
Marek Rouchal

Legend:

Unmodified
Added
Removed
Modified
  • Ticket #34168, comment 2

    initial v1  
    11The specific problem I am facing is that I need to access an existing database whose schema I cannot alter; I used the Django tool to extract the tables to create models.py, which worked great, and I already hacked the model definitions, e.g. to replace a simple IntegerField with a ForeignKey. But there are specific tables, where there is an IntegerField which may contain a ForeignKey from more than one table (think of a group and a user table; whether it is a user or a group, is defined by another column):
    22
     3
     4{{{
    35class Permission(models.Model):
    46    ...
    57    user_or_group_id = models.IntegerField(db_column='user_or_group_id', blank=True, null=True)
    68    is_group = models.IntegerField(db_column='is_group', blank=True, null=True)
     9}}}
    710
    811
Back to Top