How to Define a Custom Django Model (Django Tutorial) | Part 11

preview_player
Показать описание
Enjoyed my video? Leave a like!
Рекомендации по теме
Комментарии
Автор

user = models.OneToOneField(User)
TypeError: __init__() missing 1 required positional argument: 'on_delete'

For those who are getting the above error in Django 2.0, add on_delete=models.CASCADE as the second parameter of user field in class UserProfile since this is a foreign key.
user = models.OneToOneField(User, on_delete=models.CASCADE)

apoorvwatsky
Автор

Макс, Благодарю тебя за твой труд. Пишу на русском языке, т.к. знаю, ты его изучаешь.
Ты делаешь отличный материал который помогает людям освоить Python/Django. Очень хорошие видео обзоры. В меру короткие и по делу, ничего лишнего. Желаю тебе Успеха! С уважением, Александр Линявский (Россия)

alexanderlinyavskiy
Автор

I came to this series primarily for this tutorial. No other tutorial that are above in the search results dealt with creating databased in relation with user profile. This is very important as we would want to access data via user id after authentication. Thanks max.

atchutram
Автор

ValueError at /admin/auth/user/add/
invalid literal for int() with base 10: ''


hello max.. how to over come this error

Request Method:
POST

Request URL:

Django Version:
1.11.4

Exception Type:
ValueError

Exception Value:
invalid literal for int() with base 10: ''

harinihearty
Автор

Sorry Max, i have issue:
models.py ==>user = models.OneToOneField(User) when runserrver error: __init__() missing 1 required postional argument: 'on_detele" (Django 2.0.1)

Can you help me check ?

shaming
Автор

even with all of this years this tutorial is awesome, Thanks man, you earned a subscriber. Cheers.

jacobitosuperstar
Автор

Is anyone else having an issue where the user (OneToOneField) isn't being added into the model?

harperjmusic
Автор

So that's what the admin is for. I've been trying to rely heavily on documentation to figure out why my tables weren't present in the admin section. Got confused, altered my code a ton based of some web resources I read, gave up and now I'm here. Glad you covered it

austincopeland
Автор

Thank you...u r seriously under rated..

beautifulllife
Автор

Using you tutorial to learn ..thanks for sharing with us :)

sureshprajapati
Автор

Max, thank you so much for these videos on Django. I feel I am progressing at lightning speed thanks to you.

thelibarr
Автор

You never store phone numbers in integer fields. Phone numbers can have weird formats. E.g. starting with a + and a country code. Or in some countries, phone numbers can start with a zero.

crazor
Автор

help please
i got this

OperationalError at
no such column: accounts_userprofile.user_id

lokendraverma
Автор

Hi max goodridge even if i apply migrations its showing the same error, how can i solve this?

chinmaybendigeri
Автор

Atcually i had a question in Django. I want to implement a module called User authentication with Email verification. Once the user registers he gets a verification email and once he clicks on it he is authenticated in the system. Would you know where i can find a tutorial to this. I am fairly new to Django.

siddharthprabhu
Автор

getting OperationalError: database is locked??
plz help me

mohitgoyal
Автор

False title, this is not a custom user model, this is an extended user model

عشاقالجنان-دو
Автор

from django.contrib.auth.models import user
ImportError: cannot import name 'user
what to do???

vahabk
Автор

Almost entire world wide web is filled with example on how to customize the Django "User" model and create view.py. But no one has given an example on how to create a view.py for the default "User" model for creating forms. I am stuck from last 3 weeks without any help. can you help me?

as