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

Extract Logic and Valiation from forms and views #207

Closed
wants to merge 1 commit into from
Closed

Extract Logic and Valiation from forms and views #207

wants to merge 1 commit into from

Conversation

larubbio
Copy link
Contributor

So it will be possible to expose a REST interface the logic and validation
behind the forms and views needed to be extracted. Two new files were
created, services.py and validators.py.

services.py:
Exports a static method 'signup' that contains the logic previously
contained in the signup view class.

Exports a static method update_email that contains the logic previously
contained in the settings view class.

validators.py:
Exports static methods that clean and validate username, email and passwords

The changes in forms.py and views.py is the removal of the above logic which
is replaced with calls to the newly exposed methods.

So it will be possible to expose a REST interface the logic and validation
behind the forms and views needed to be extracted.  Two new files were
created, services.py and validators.py.

services.py:
Exports a static method 'signup' that contains the logic previously
contained in the signup view class.

Exports a static method update_email that contains the logic previously
contained in the settings view class.

validators.py:
Exports static methods that clean and validate username, email and passwords

The changes in forms.py and views.py is the removal of the above logic which
is replaced with calls to the newly exposed methods.
@brosner
Copy link
Member

brosner commented Jan 18, 2016

Thank you for the time you've spent on this. Breaking out this logic is important and on the roadmap for this project. However, I have a lot of strong opinions on how the APIs should defined for the break-out logic. I need to spend some time collecting these thoughts and write them down.

If you are willing to stick through it and help implement these ideas, that would be really appreciated.

@larubbio
Copy link
Contributor Author

What is your timeframe on this? The project I'm on is looking to use this and some other apps behind a REST api. So I'm willing to help, but if the timeframes don't align I'll have to keep moving on my project and try to merge the changes.

Do you have any of the API thoughts written down yet?

@brosner
Copy link
Member

brosner commented Jan 20, 2016

I am working on a project at work which has a similar requirement of a REST API and integration with django-user-accounts. I can't commit to a timeframe, but this isn't just theory and hope. However, due to constraints with deadlines there may be less time to produce perfect designs to contribute here.

I will have more of my thoughts written down this week and I am happy to share them here.

@larubbio
Copy link
Contributor Author

Great, I'd love to see what ideas you have and how I can help.

On Wed, Jan 20, 2016 at 6:38 AM, Brian Rosner notifications@github.com
wrote:

I am working on a project at work which has a similar requirement of a
REST API and integration with django-user-accounts. I can't commit to a
timeframe, but this isn't just theory and hope. However, due to constraints
with deadlines there may be less time to produce perfect designs to
contribute here.

I will have more of my thoughts written down this week and I am happy to
share them here.


Reply to this email directly or view it on GitHub
#207 (comment)
.

@ossanna16
Copy link
Contributor

@larubbio Please also feel free to join our Pinax Slack team for further discussion 😊 http://slack.pinaxproject.com

@paltman paltman closed this Nov 24, 2021
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

Successfully merging this pull request may close these issues.

None yet

4 participants