Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How can I extend PhoneDevice model? #269

Open
jourdanrodrigues opened this issue Apr 18, 2018 · 2 comments
Open

How can I extend PhoneDevice model? #269

jourdanrodrigues opened this issue Apr 18, 2018 · 2 comments

Comments

@jourdanrodrigues
Copy link

Just like we can do with Django's built-in User model (here's how it works).

What I'm doing to get over it is to create helper classes wrapping the PhoneDevice model, but it just doesn't sound right.

If this isn't already implemented and you don't want to do it yourself, I'd be happy to contribute with a PR, I just need a thumbs up and your word that it won't take long be released.

@moggers87
Copy link
Collaborator

Making PhoneDevice pluggable like User is probably the wrong way to go as you'd have to do it for every other type of device too.

Based on your previous issue, I assume you're wanting to change the way PhoneDevice.generate_challenge works. It should already be possible to swap in your Device subclass by:

  • Subclassing LoginView and overriding get_device
  • Overriding either sms or call in SetupView.form_list with your own PhoneNumberForm that points to your model

I'd be happy to contribute with a PR … and your word that it won't take long be released.

You can specify a git repo + a commit ID in your requirements file, there's no need to pressure upstream into making a release ☺

@jourdanrodrigues
Copy link
Author

jourdanrodrigues commented Apr 19, 2018

Got it, @moggers87.

That's actually not my use-case, I got the answer for that by manually hitting the API and seeing what happens.

My case is that I'm seeing that there's a lot of operations I'm doing with PhoneDevice instances makes sense to be instance/static/class methods. Doing a wrapper as I'm doing right now seems quite ugly.

Cool. I'll take a look into it, but I'd still have the PhoneDevice from the package migrated in the database, right?

Good to know about the git repo + commit ID, though it seems kinda hacky. 😂

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants