raven
so why are u using usermodel? maybe you should rather create your own CustomUser
Shikhar
so why are u using usermodel? maybe you should rather create your own CustomUser
Hmm. Nice suggestions. But there are many fields in auth_user. Do I need to create every field or just those which I need
Anonymous
Hi I want add bitcoin payment to my app Wich way is better?
Anonymous
Hello.. How can I add currently logged in username as a field in a model? Below is my example model. I want to add another field with name 'added_by' to it but not sure how. https://hastebin.com/inepofamog.py
Anonymous
Use request.user
I have tried overriding default save method as below based on a thread from the internet. But it gives me an error. Below is the method which I have added within the model class: def save(self, *args, **kwargs): # If added_by is empty set it to the username if not self.added_by: self.added_by = self.user.username
Anonymous
Otherwise you add that in your views.py By storing request.user in a variable and then store that data into your db
Anonymous
Have you tried that self.added_by= self.user.name
I have tried it too. I get an error " AttributeError: 'Contact' object has no attribute 'user' "
Anonymous
self.added_by= self.name It will works
Anonymous
self.added_by= self.name It will works
It doesnt work for me. I get: AttributeError: 'Contact' object has no attribute 'name'
Ghorz
https://hastebin.com/kanefenani.py
In your view, form.instance.added_user=request.user
Anonymous
In your view, form.instance.added_user=request.user
I see you have used settings.AUTH_USER_MODEL. Would it work if a non-admin signs in?
Anonymous
Yes, as long as its an authenticated user
Oh great. That's exactly my requirement. I will try this method and see how it goes
Ghorz
The name and email field is not necessary since user field contains name and email
Ghorz
added_by.email added_by.first_name ....
SuperN00b
Hi guys , can u guys help me for this ?
SuperN00b
After I add urlpatterns into project url file , the admin page can not be found
SuperN00b
Any hints pls ?
Kiro
Hi i wanna ask when i set my models relation like category = models.ForeignKey(Category, on_delete=models.CASCADE,) i thinks my relation result CASCADE but why i checking my db my relation be restict
Kiro
sorry for my bad english, before
Bunty chhatri wala..
SuperN00b
Maybe you have removed your admin link from patterns
No , i never touch it bro , it still locate in patterns
Anonymous
No , i never touch it bro , it still locate in patterns
Maybe you removed the import in your project urls.py file: from django.contrib import admin
AAMIR
multivaluedictkeyerror how to solve it.....
Kiro
multivaluedictkeyerror how to solve it.....
just don't use id or name in your post file
Anonymous
Hi Guys , ı have question and problem :( ı try upload picture when ım upload picture images roration upload wrong :( what can ı do fixed tihs bug ?
Crbc
Hi , someone have used Next js and Django?
Ghorz
None😐
I assumed you have different method that's why you asked for opinion. Do your research, work on something, develop your code, diversify it. By then you'll be well experienced to know the best method and as well as ask for opinion.
Ghorz
Hi Guys , ı have question and problem :( ı try upload picture when ım upload picture images roration upload wrong :( what can ı do fixed tihs bug ?
Please explain in detail. Did you use an image processing plugin. If not, then it's the image you uploaded that has the issue.
Ghorz
Try a different image if you'll get same result
Ghorz
Do i add payment or give every user Choose one
Anonymous
🤦‍♂i ask to know wich one is better
Anonymous
Sorry My English is awful
Lalit
Please suggest good video tutorials for django 2
Mirco
!res
Doragonsureiyā
Check out PythonRes, a channel for Python resources (links to help you out).
Gaurav
Hi everyone! I am about to begin django any tips for this newbie..? Thanks
WhiteDevil
I started to learn Django training from Telusko YouTube channel
WhiteDevil
It is good
WhiteDevil
You can refer the official documentation
Ghorz
🤦‍♂i ask to know wich one is better
One one have you implemented?
Ghorz
🤦‍♂i ask to know wich one is better
I have just the right answer for you below https://duckduckgo.com/?q=which+one+is+better&ia=web
Lalit
Anyone have durga sir django notes
Mihail
how can i change background in django site? i've already tried everything. css file works well, but can't change a background
Sultonbek Ikromov
i want to put image as a background
in css file .somediv{ background-image:”path” }
Sultonbek Ikromov
trying
did you give width and height?
Sultonbek Ikromov
what should i write in path?
the directory of your image
Sultonbek Ikromov
../templates/images/image.jpg “exaple"
Mihail
from "static" folder?
Mihail
the directory of your image
.somediv{ background-image: ”static/home/site.jpg” } didn't work
Sultonbek Ikromov
Mihail
i'm using 'static' folder for images and css. templates folder is for .html files
Sultonbek Ikromov
the real problem is your project cannot import css
Alex
i'm using 'static' folder for images and css. templates folder is for .html files
Ohohoh already tried a {% load static %} and for the source {% static 'image.jpg' %}
Alex
Better read on serving static files, you definitely will face more troubles
Mihail
css works well
Mihail
i checked it
Alex
Doesn't matter, theres a clean way to add static files and its even nicely explained