0

How to change the model fields of an existing model which is in a package? (pip install fcm-django - FCMDevices), I need to add extra columns to that model and rename some of the fields.

like column registration_id in (package model) need to rename as fcm_id

  • Why do you need to rename the columns? Do you want to change the actual column name in the DB or just in the model? – Iain Shelvington Feb 24 '22 at 04:05
  • yes, need to change in both DB and model – Mahesh babu Feb 24 '22 at 04:27
  • 1
    But why do you need to change the columns? Extending the model with direct inheritance is easy but won't allow you to change the columns – Iain Shelvington Feb 24 '22 at 04:49
  • there is a field `user` in which I need to create a ForeignKey relation like `user_id` with other table, so I want like the same table with not previous columns, and also need to overwrite the previous ones – Mahesh babu Feb 24 '22 at 05:31
  • If you have a custom user model you should have set the `AUTH_USER_MODEL` setting to point to your custom model, the `FCMDevice.user` field will then point to that model without the need to extend or override anything – Iain Shelvington Feb 24 '22 at 05:35
  • Where as, direct inheritance will create two tables, is there any way that it will be a single table? – Mahesh babu Feb 25 '22 at 00:32

0 Answers0