-
Notifications
You must be signed in to change notification settings - Fork 0
added student profile model, student profile page, student profile views #5
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
base: master
Are you sure you want to change the base?
Conversation
ennead/app.py
Outdated
| app.add_url_rule('/logout', 'logout', logout) | ||
|
|
||
| app.add_url_rule('/student_profile', 'read_student_profile', read_student_profile) | ||
| app.add_url_rule('/student_profile', 'create_student_profile', create_update_student_profile, methods=['POST', 'PUT']) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
PUT же мы в итоге решили, что не нужен?
ennead/app.py
Outdated
| app.add_url_rule('/logout', 'logout', logout) | ||
|
|
||
| app.add_url_rule('/student_profile', 'read_student_profile', read_student_profile) | ||
| app.add_url_rule('/student_profile', 'create_student_profile', create_update_student_profile, methods=['POST', 'PUT']) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| app.add_url_rule('/student_profile', 'create_student_profile', create_update_student_profile, methods=['POST', 'PUT']) | |
| app.add_url_rule('/student_profile', 'create_student_profile', create_update_student_profile, methods=['POST']) |
ennead/models/student_profile.py
Outdated
|
|
||
| user: User = ForeignKeyField(User, backref='student_profiles') | ||
|
|
||
| def set_profile(self, request: Request, user: User = None) -> None: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Вот это в view унести
ennead/views/student_profile.py
Outdated
|
|
||
| student_profile = StudentProfile() | ||
|
|
||
| student_profile_query = StudentProfile.select().where(StudentProfile.user == g.user) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
g.user.student_profiles[0]…et in views to backref
ennead/models/student_profile.py
Outdated
| from ennead.models.base import BaseModel | ||
| if TYPE_CHECKING: | ||
| # pylint: disable=R0401 | ||
| from ennead.models.thread import Thread # noqa: F401 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
А где ты его используешь?
ennead/views/student_profile.py
Outdated
| """GET /student_profile: read profile page""" | ||
|
|
||
| student_profile = None | ||
| try: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Не-не-не.
if g.user.student_profiles:
student_profile = g.user.student_profiles[0]
else:
student_profile = StudentProfile()
No description provided.