hyperlog-core / hyperlog-backend

Backend for hyperlog
0 stars 0 forks source link

Change profile models to disable use of proxies #26

Closed nikochiko closed 4 years ago

nikochiko commented 4 years ago

I had decided to use proxies to create django profile models for third party providers. That would be good if there are lots of providers or multiple accounts with one user. Instead it is more convenient to just use One-to-one fields because we only have limited providers. I am running into bugs with proxies (e.g. I edited the manager for GithubProfile to have the provider attribute set to "github" but I did not use the manager.create way because it does not run validations on the fields. So the provider attribute was being set to "" - although the field is supposed to non-nullable).

So if we are only going to have limited few OAuth providers then we can just go with one model for each service. This can be done with minimum (or none) schema changes. Still low priority.

Edit: Even better is that we can just subclass the original models without attributing the base model as abstract. This allows two or more models with similar interface to coexist without causing clashes.