Maz
AttributeError at /schoolbus/schooladmin/home/ 'NoneType' object has no attribute 'name'
Maz
how do i pull the school name?
inchidi
AttributeError at /schoolbus/schooladmin/home/ 'NoneType' object has no attribute 'name'
its because your staff doesnt have school related to it yet
Maz
oh, okay.
Maz
so displaying just school name...?
Maz
did this script raise any error?
havent done it in shell yet....just used the template and orm.
amit
i have been developing a social media website with an guy who knew Django and he had an accident and he is on bed . And the website is stuck .
amit
CAN you redirect me who could help with completing the project. I can pay you stipend
David
Hello, I'm trying to save a user profile attached to the django user models. But when sending the form, it returns an error saying Exception Value: 'AnonymousUser' object has no attribute '_meta'. Here is the generated stacktrace: http://dpaste.com/1GK8MK5 BTW, I'm following this article: https://simpleisbetterthancomplex.com/tutorial/2016/07/22/how-to-extend-django-user-model.html
David
My template's code
David
the views.py code
R
Have you created the signals?
R
In the example you are following, he's creating the profile through a signal and then just editing it in the view
David
So it doesn't work to create the profile at the same time as the user?
David
These are the signals
R
So it doesn't work to create the profile at the same time as the user?
No, probably if after saving the user and before saving the profile, you assign the created user to the profile_form user should work or maybe inline_formset although I'm not sure if it works on onetoone or only fk https://docs.djangoproject.com/es/2.1/topics/forms/modelforms/#inline-formsets
R
Anyways, if you want to do it with signals as in the example you are following you are missing to get the user and profile instance on the view
Shubham Gajra
Hey , new django learner
Shubham Gajra
Had a lil doubt if anyone can help
Shubham Gajra
I was extending from django's User class for additional attributes like profile pic n other details
Shubham Gajra
class ProfileInfo(models.Model) user = models.OnetoOneField(User, on_delete=models.CASCADE)
Shubham Gajra
I always picture model as a table and attributes like fields
Shubham Gajra
I have a little trouble understanding how is this user mapped in my database table
R
I have a little trouble understanding how is this user mapped in my database table
https://docs.djangoproject.com/es/2.1/ref/contrib/auth/#user-model
Django Bot
>> Blogs - django-html-validator now supports Django 2.x
R
You can also extend AbstractUser
Jimmies San
https://github.com/mbi/django-simple-captcha
Jimmies San
someone used it? it works? :D
R
ain't the instances the paramaters recieved by the form's in the post request?
If you check, in the example view he's updating an existing user and profile that's why in his else part he sets default values in the forms, thing that your code does not have but it might be correct if you want to create both user and profile in the form, but then you should assign the created user to the corresponding profile form before saving it as explained previously
Django Bot
>> Links - Django Packages : Reusable apps, sites and tools directory
Abhi
Hey guys I made a few projects in diango... But I didn't use models much Is there any good reference or guide to getting comfortable with using models for my future projects?
Django Bot
>> Links - GitHub - getsentry/sentry: Sentry is cross-platform application monitoring,
Anonymous
It's a book
Daniel
great book btw
Luis
Do we have a new version of that book?
Daniel
https://docs.djangoproject.com/en/2.1/internals/contributing/writing-code/coding-style/
Django Bot
>> Links - How to Use Bootstrap 4 Forms With Django
Django Bot
>> Links - Forms have never been this crispy — django-crispy-forms 1.0.0 documentation
Django Bot
>> Blogs - Django vs WordPress: How to decide? >> Links - How to Use Bootstrap 4 Forms With Django
Django Bot
>> Links - vitorfs/colossus: Self-hosted email marketing solution
Django Bot
>> Links - Wagtail, a Django CMS
Abhi
Hey guys,
Anonymous
hi
Abhi
i was reading serialization on drf websites I came accross This code: https://pastebin.com/8uM5Aze8
Abhi
what is the meaning of this statement: instance.title = validated_data.get('title', instance.title)
cj
what is the meaning of this statement: instance.title = validated_data.get('title', instance.title)
the instance's title will get the title value from the serializer, if it is valid, else it will maintain its title
Abhi
what is validated_data? Is it the new instance?
cj
what is validated_data? Is it the new instance?
validated_data is the data that goes through the defined serializer and pass the validations against its fields
cj
it's not a ModelSerializer, only a Serializer, but yes, if he wants to interact with an instance, it has to be a ModelSerializer
Abhi
ok thanks!
inchidi
uh wait, this statement is false the instance could be passed when __init__ called
cj
uh wait, this statement is false the instance could be passed when __init__ called
yes, but using a ModelSerializer will be more explicit if he is working with a model instance
inchidi
true
cj
lol, why did you delete your message? it was usefull for the record
inchidi
its misleading
Django Bot
>> Blogs - Django lock decorator with django-redis
Django Bot
>> Links - Django Tutorial Part 3: Using models - Learn web development | MDN
Netphantom
Howfa
Netphantom
pictures not allowed ?
cj
pictures not allowed ?
What do you want to post that can't be explained by words?
Netphantom
here is the problem tho am using django-pagedown and i can see the pasted url image into the WYSIWYG stuff but after posting the image can't show up tho
Netphantom
all i can see is the pasted code
Netphantom
if u know u know
Django Bot
>> Links - Django Content Management System | Wagtail CMS - How to customize the admin actions in list pages of Django admin? - Peter Bengtsson: Django lock decorator with django-redis
Anonymous
Is there any free servers for Django web applications? Please text me some links
Rohan
pythonanywhere.com
inchidi
heroku.com too
Anonymous
Thanks
r0b0t
hey guys I'm gettiing this error: Cannot assign "<User: admin>": "Profile.supervisor" must be a "Profile" instance.
r0b0t
https://gist.github.com/r0b0tt/44f7dc971dc4a1208548a9fa074f4670
r0b0t
That's my Profile model
r0b0t
Anyone know what could be the issue?
Anonymous
Is it OK to write my API in my website project folder
Anonymous
Or to write it as a different project
Django Bot
>> Jobs - Django-cms / Wagtail part time remote
Anonymous
hey guys I'm gettiing this error: Cannot assign "<User: admin>": "Profile.supervisor" must be a "Profile" instance.
You are trying to assign a user object to a relation ship that requires a profile instance
Anonymous
The problem is in the view function, not the models