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

add on_delete variable to ForeignKey function and change unicode function to str in web/models.py #97

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

Mortaza-Karimi
Copy link

سلام آقای جادی. من تو برنامه نویسی دیدم که توی پایتون 3 (و یا بقیه) یه متغیر on_delete توی تابع ForeignKey بیشتر لازم داره و اینکه تابع unicode توی نسخه های جدیدتر اسم رو روی اون خرج و یا اطلاعاتی که وارد مدل میکنیم، نمی ذاره و من اون رو به str تغییر دادم.

return "{}_token".format(self.user)


class Expense(models.Model):
text = models.CharField(max_length=255)
date = models.DateTimeField()
amount = models.BigIntegerField()
user = models.ForeignKey(User)
user = models.ForeignKey(User,on_delete=models.CASCADE)
Copy link
Author

Choose a reason for hiding this comment

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

مثلا در اینجا توی نسخه پایتون من ارور میداد و این متغیر رو میخواست

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.

1 participant