-
Notifications
You must be signed in to change notification settings - Fork 16
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
Amirsalar hosseini & Arwin jafari #5
base: main
Are you sure you want to change the base?
Amirsalar hosseini & Arwin jafari #5
Conversation
…e appointment model
…ppointment, location model to their apps
Since you have already committed i recommend you remove .idea directory since its just a part of pycharm not the project |
class Service(models.Model): | ||
name = models.CharField(max_length=100) | ||
description = models.TextField() | ||
duration = models.DurationField() |
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.
durationfield gets value in a timedelta fomat not minute
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.
The purpose of creating the duration field is to determine a specified time for the end of a task. If I used the integer field, I would have to set a series of configurations for this field, but this field uses the timedelta method and it is the best in terms of optimization. The input of this field is in the format of time, and if it is entered as a single number, it will be converted into seconds!
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.
having docstring and str method is best practice
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.
Thank you very much for your suggestions
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.
Currently, the purpose of writing the str method is to display the clear specifications of an instance in the management panel, and instead I used the decorator and management classes to tabulate its specifications in the management file. In Django, thanks to the overriding feature, we can avoid writing this method as much as possible, which I think helps to write clean code.
updated by ME and @ArvinNotDev
for this request we create two apps(appointment and medicine) and complete their models