inchidi
Somebody
course_details=Course.objects.filter(slugs=slugs).values('price','name') print(course_details.price) print(course_details.name)
Somebody
shows error QuerySet' object has no attribute 'price' and'name'
Somebody
anyone please help
Somebody
share your Course model
it has fields which i mention
Charly
shows error QuerySet' object has no attribute 'price' and'name'
a queryset holds multiple objects, so use index to access these objects: course_details[0].price
Somebody
share your Course model
Course model has name,price fields
Somebody
a queryset holds multiple objects, so use index to access these objects: course_details[0].price
course_name=Course.objects.filter(slugs=slugs) print(course_name)
Somebody
only one object return
and that's i want, but accessing fields shows error
Charly
only one object return
yes but still is like a a list
Charly
if you want to only get and object use get instead of filter
Kaps
is crispy form to be used? or normal django forms are fine
Somebody
yes but still is like a a list
you are write .. it works, but if get method not find method it raise exception
Charly
Kaps
but whats industry standard?
Kaps
i am kinda new to Django
Charly
but whats industry standard?
no standard, it depends on the project
Kaps
for a fresher like me...pls guide
Charly
for a fresher like me...pls guide
first lerarn base django components
Kaps
can u check my dynamic menu generation logic and lst know if there is any other better way to achieve the same.
Doragonsureiyā
can u check my dynamic menu generation logic and lst know if there is any other better way to achieve the same.
To share code or error tracebacks, use a pasting service, like: - https://linkode.org - https://dpaste.org
Somebody
and we have try/except blocks to deal with it
do you know how to redirect page in javascript. i am not familar with javascript. i tried from online but the data i send to the html page i couldn't pass through javascript.
Kaps
ok
Somebody
This not a javascript group, and is easy to google that
i know that ,i just want to know do you know that or not
Maxim
Maxim
ya
recommend that you delete offtopic messages
Somebody
recommend that you delete offtopic messages
i didn't not asked offtopic . i asked django+javascript doubt how to redirect , i dont think i made mistake . if it is wrong i will delete
Charly
Even after I told you that we don't discuss javascript here
Somebody
ok my mistake. i apologie
Maxim
ok my mistake. i apologie
recommend that you follow this recommendation
Kaps
I have put the parts of views.py and nav.html code on dpaste.org for dynamic code generation. Can someone let me know if there is any better way to achieve it.
Kaps
The URL is https://dpaste.org/zju8S/slim
Basel
hello in django rest i use put
Basel
put it's giv me AttributeError at /employmentname/xyz type object 'enmployment' has no attribute 'objects'
Basel
when insert data
Basel
so this view def put(self, request, *args, **kwargs): obj=enmployment.objects.get() data=request.data obj.name=data["name"] obj.age=data["age"] obj._from=data["_from"] obj.save() serializer_class = enmploymentserializers(obj) return response(serializer_class.data)
Basel
any one can help me 🙏🙏
Doragonsureiyā
any one can help me 🙏🙏
Looking for Django tutorials? you can follow these three recommended ones: * Official documentation and tutorial * Tutorial from MDN * Tutorial from django-girls
Basel
models class enmployment(models.Model): name = models.CharField(max_length=100,null=True) age = models.CharField(max_length=100,null=True) _from = models.CharField(max_length=100,null=True) def __str__(self): return self.name
Basel
do u have think y
Charly
do u have think y
you probably have another variable whit that name and clashing
Baba
How can I create an instance of OneToOneField when a new user is created?
Azizbek Xushnazarov
How?
you know how to use signals in django?
Azizbek Xushnazarov
No
well. then consider learning it. very useful feature. if you dont want to use signals then it is easy to create O2O field instance. what is the problem?
Azizbek Xushnazarov
No
class Profile(Model) user = O2OField(User) ... # first create user instance user = User.objects.create(...) # then profile profile = Profile.objects.create(user=user, ... )
Zeinab
Hi How can I migrate a csv file in Django?
Ahmed
Just wait
Doragonsureiyā
Just wait
What are you talking about?
#M...
Hello friends Does anyone know what to do to create a form that also has an image field? So that the image is stored in the database and used in the templates?
Christian
Hello friends Does anyone know what to do to create a form that also has an image field? So that the image is stored in the database and used in the templates?
You don't store images files in the database, just a link to the file in your media folder. Google "django upload file" or "django upload image" and select the turorial/article best suits for you
Anonymous
How to track Django user online status by Django channel
datasus
Pls I need some help
Doragonsureiyā
Pls I need some help
Not until you explain your difficulties.
Anonymous
How to do Django channel 3 with jwt auth
Anonymous
How to access logged in user in models.py
Sleeping
Anyone have knowledge of pythonanywhere
Drago
Anyone have knowledge of pythonanywhere
I have, recently I've deployed my test site
Drago
Tell me anyone
Unfortunately in this chat, I can't send link
Sleeping
I have, recently I've deployed my test site
Something went wrong :-( Something went wrong while trying to load this website; please try again later. If it is your site, you should check your logs to determine what the problem is.
Sleeping
Unfortunately in this chat, I can't send link
2022-04-30 07:27:10,822: Error running WSGI application 2022-04-30 07:27:10,833: ModuleNotFoundError: No module named 'project' 2022-04-30 07:27:10,833: File "/var/www/komaldhote_pythonanywhere_com_wsgi.py", line 14, in <module> 2022-04-30 07:27:10,833: application = get_wsgi_application() 2022-04-30 07:27:10,833: 2022-04-30 07:27:10,833: File "/home/komaldhote/.virtualenvs/mysite-virtualenv/lib/python3.8/site-packages/django/core/wsgi.py", line 12, in get_wsgi_application 2022-04-30 07:27:10,833: django.setup(set_prefix=False) 2022-04-30 07:27:10,833: 2022-04-30 07:27:10,833: File "/home/komaldhote/.virtualenvs/mysite-virtualenv/lib/python3.8/site-packages/django/init.py", line 19, in setup
Harry gorilla
MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: Order nr. 6 From: admin@myshop.com To: name@gmail.com Date: Sat, 30 Apr 2022 16:27:48 -0000 Message-ID: <165133606876.58514.15471153081792602146@fedora> Dear name, You have successfully placed an order.Your order ID is 6. [2022-04-30 16:27:48,765: WARNING/ForkPoolWorker-2] ------------------------------------------------------------------------------- I am seeing this message from celery, yet i can't see that message on my email. How is that supposed to work? I think am also supposed to get that message on my email right?