User Profile With One To One Relationship | Django (3.0) Crash Course Tutorials (pt 16)

preview_player
Показать описание

Extend users profile with a one to one relationship to a separate model that will hold more user details.

Рекомендации по теме
Комментарии
Автор

BUG FIXES: In views.py on line 34 I added the name attribute to a customer on create. Not adding a name to the customer on create will give us an error if we try to view that customer profile since the name needs to be returned in the model __str__ method. Source code updated..


New create method should look something like this:


Customer.objects.create(
user=user,
name=user.username,
)

DennisIvy
Автор

I've been pausing before Dennis actually implements each piece, trying to figure it out myself. This incredible series plus a little effort and pausing and trying to find a solution myself has helped me so much. This is an incredible series and framework!

JohnnysaidWhat
Автор

You're my favorite teacher among all the others, you speak less and do more.
usually, other guiders need 3 videos of 20 minute each for what you are able to explain in less than 10 minute long video .
and you go more in depth and cover a lot more essential things.

sort_to_see_hidden_comments
Автор

Dennis, special thanks bro, these tutorials have put the confidence back in my life. it is been 4 days and I could pick up most of it.. thanks once again. :)

sante
Автор

I'm a Beginner Django Developer But im getting some knowledge from your video . Thanks For duch great content. We are expecting much more Advanced tutorials from your dide

loksewabyte
Автор

I'm really thankful to you, it has been great journey yet 💖💖

saddam_khan_abuzaid
Автор

Thank you so much Dennis! You've done a really wonderful Job!! Siddhi from India....

siddhichavan
Автор

Cascade does not mean that the relationship is deleted, but actually that the child element ist deleted. Id est if a user is deleted, the associated customer is deleted as well.

PrimevalShrimp
Автор

In the customer model:
class Customer(models.Model):
...
....

def __str__(self):
return str(self.name)

taeteahulu
Автор

Oh!! It was an awesome journey with this episode. Now i can handle any unauthenticated request in my Software.

walidnewaz
Автор

hey there, in 4:00 - 4:50 you make orders = . I do not understand where order_set comes. my terminal gives me an attribute error saying customer object has no attribute order_set

stepbro
Автор

every part is awesome, best explanation.

pankajmodi
Автор

Love your videos! Best django tutorials I have come by so far :)


I did have an issue with a the customer created before applying the bug fix. I ended up with a customer that I could not delete in the admin panel. It gave me __str__ returned non-string error. This was because the __str__ function in the Customer model returned None (models.py). Had to changed the return to: return self.name or ' ' and then I was able to delete the customer.

ugel
Автор

Денис, молодец, полезное видео! Сейчас как раз этим воспользуюсь)

MrYoklmn
Автор

i'm facing a problem that when i linked my customer to a user in django admin then how can i login the customer to see his records.

ahsamyousaf
Автор

Hello @Dennis Ivy
Bro, i need a help. I was following your course. And in this section i tried to take all orders from customer,
orders =
But it's giving me an error that, AttributeError: 'Customer' object has no attribute 'order_set'.
i've checked my models.py and models relations... everything is almost similar don't have any major change. And i can't solve it in that case. So, will you please help me.
I can share source code in Github if you want.
Thanks in Advance.

abdullahalnahdi
Автор

Hey Dennis do you have a tutorial for Admin panel, I want to prevent supperusers from login direct to admin panel

Kennerdoll
Автор

Can someone explain me the orders = command, please

gustavoroque
Автор

I like your tutorials and I followed all your Django crash course tutorials until this one-to-one user profile. I think my head is kinda overload at this moment and will be exploded anytime soon (laugh). But I am stuck at the part of user role base permission. I just wondering if Django docs have provided some source code as yours, especially in decorators.py.

ahmadirfan
Автор

what if i didnt use the User model but my own custom model; what do i put for orders=request.?

daring