Skip to content

added student profile model, student profile page, student profile views#5

Open
torilov wants to merge 4 commits intomasterfrom
student-profile
Open

added student profile model, student profile page, student profile views#5
torilov wants to merge 4 commits intomasterfrom
student-profile

Conversation

@torilov
Copy link
Copy Markdown

@torilov torilov commented Jun 22, 2019

No description provided.

Comment thread 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'])
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

PUT же мы в итоге решили, что не нужен?

Comment thread 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'])
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
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'])

Comment thread ennead/models/student_profile.py Outdated

user: User = ForeignKeyField(User, backref='student_profiles')

def set_profile(self, request: Request, user: User = None) -> None:
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Вот это в view унести

Comment thread ennead/views/student_profile.py Outdated

student_profile = StudentProfile()

student_profile_query = StudentProfile.select().where(StudentProfile.user == g.user)
Copy link
Copy Markdown
Member

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]

Comment thread 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
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

А где ты его используешь?

Comment thread ennead/views/student_profile.py Outdated
"""GET /student_profile: read profile page"""

student_profile = None
try:
Copy link
Copy Markdown
Member

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()

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.

2 participants