Satyam
Okk
But can anyone suggest from all these ?
Fidèle
I'm running in a bit of trouble.
In fact I want to register new users but I don't want to generate form because I already have the (UI) template coded with all the CSS and JavaScript.
Isn't it possible to link that template I have created to django instead of generating a new form then customize?
Thank you for replying
Liza💻
def calculate(request, num1):
result1 = num1 * num1
result2 = num1 * num1 * num1
r1 = HttpResponse ('square is =' = 'result1)
r2 = HttpResponse('cube is =' result2)
return r1, r2
Anonymous
I am having an issue when running my django web on chrome browser in developer mode
Liza💻
I can't return the value any error in this code
Liza💻
Can anyone helped urgent
Doragonsureiyā
Can anyone helped urgent
Is it urgent?
You shouldn't be here, wasting time and poking strangers and waiting for them to do your job for you.
Search on Google/DuckDuckGo, do the research, and solve your problem yourself, nobody here will drop what they're doing to do your job, just because "it's urgent!".
Have a nice day! 😉
Charly
Charly
Liza💻
Charly
Liza💻
Ok
Liza💻
I need to return 2 values
Liza💻
Ok
Liza💻
Don't want concatenate jut print the outputs
Liza💻
That's all
Павел
Hello everyone! I have a question about order_by for JSONField:
I have a model, it has a "name" field with a JSONField data type (stores a specific name for each of the languages in the format {"en": "Salary", "ru": "Зарплата"}. In a certain case, I need to receive values from this model using the "filter" method, and I need to sort these values alphabetically depending on the language that the user has selected
For this case I made a function, here is the code: https://www.toptal.com/developers/hastebin/koxizevamu.py
As an argument, the function receives a string value of the user's language and substitutes it into order_by. If the language is English (specified 'en'), then there is no problem - sorting is successful. But for the most part, the Russian language will be used, and here the sorting breaks down. The values are in any order, but not alphabetically. And even if in "order_by" I add not "name__ru", but "-name__ru", it is clear that the sorting is changing, but still it goes wrong.
Is this a problem exclusively in using the Russian alphabet through JSONField? Since if there was just a "char" data type, then sorting was always in order with Cyrillic. Or am I doing something wrong?
upd: i’m using postgresql
Fan / Ac
is there something that i can refer with examples for proper status code for api calls
Fan / Ac
i see mozilla docs is a place
😎Anil
ImportError: Couldn't import Django. Are you sure it's installed and available on your PYTHONPATH environment variable? Did you forget to activate a virtual environment?
😎Anil
this is error im getting anyone help me to solve thid issue...
Abdulrasheed
😎Anil
I tried both ways virtually and normally but not working same problem
😎Anil
Can i send pics here
Doragonsureiyā
John
Hello , I need a help. If i want to use bootstrap template with django Modelform, what name or id I must give to my input by default. Thanks
Fan / Ac
so there is a field which accepts many users name separated by comma
so if one of those users name doesnt exist, i cant process the post request, so whats the proper status code that i can send back to the post request
also say there is a field which only accepts file and users send text,
what will be proper status code to send to the user saying its not allowed ??
Neo
Fan / Ac
Neo
Neo
Unless someone else knows what is more applicable
Neo
It's all good as long as your client app is ready to handle it. Some APIs even use HTTP 200 in all responses with custom error code to signify what went wrong
Fan / Ac
sure why not
ah ok, i get confused when reading status code descriptions
like for HTTP 401
WWW-Authenticate: Basic realm="Access to staging site"
what does the basic realm thing actually mean
Fan / Ac
Neo
CryptoHunt
Hello guys, help me please how to make in more grammar way:
I have search function that iterate through all objects of model, when i getting queryset with search results, i add this result to Paginator class and returning page by page
My question is: how not to iterate through whole db and make pagination but how generate results page by page?
(⌐■-■)
hello. i am making an online ide project. I am using jQuery AJAX at login page to handle function calls from views.py file. At login page when i am providing invalid credentials for login, AJAX works fine by showing error msg without reload. but with correct credentials the AJAX is still getting called and i am not able to proceed to my next page after login. Can someone help me through it?
(⌐■-■)
(⌐■-■)
@LSR
How we can count how many times linked was clicked
KENNEDY
not_found
I need help in drf, anyone has good knowledge of drf
Charly
not_found
class Add_Product(APIView):
def post(self,request,*args, **kwargs):
user=request.user
if user.is_authenticated:
data=request.data
date=datetime.now().date()
slug=user.username+"-"f'{int(time())}'
print(data)
serializer=ProductSerializer(data=data,many=True)
if serializer.is_valid():
print(serializer.data)
serializer.save(user=request.user,slug=slug)
return Response("Your product is added")
return Response(serializer.errors)
return Response("Login First")
not_found
How to convert this api view to createModelMixin
Steve
Question
I am developing a like button feature in my django app and getting the error :
'method' object does not support item assignment
My views.py, specifically in context ["total_likes"] = total_likes
class PostDetailView(DetailView):
model = Post
def get_context_data(self, *args, **kwargs):
context = super(PostDetailView, self).get_context_data
post = get_object_or_404(Post, id=self.kwargs['pk'])
total_likes = post.total_likes()
context ["total_likes"] = total_likes
return context
Kennedy
Hello guys I have problem, I have 2 models
Profile - connected to User via OneToOneField
Products - connected to User via ForeignKey
So in my views I want to fetch profileData of a user on a single product.
How can I achieve this using DRF?
gadghimuradm
gadghimuradm
Oh, u need use related name for o2o field.
class Profile:
——...
——user = OneToOneField(to=User, related_name='profile')
——...
And then u can call user.profile
Mystery P.
Django project
file:
"urls.py"
There is NameError in my code:
from django.contrib import admin
from django.urls import path
urlpatterns = [
path(r'^admin/', admin.site.urls),
path(r'^webapp/', include('webapp.urls')), #in this string
]
renders:
NameError: The name "include" is not defined
what must i do?
Crygo
Crygo
from django.urls import path,include
Mystery P.
Ilsaf
Such problem lifted the project in docker via compose with redis. Then I start the celery worker and it says that everything is fine connected to the redis, but when I send a request to the server through the swagger, it just loads and then writes that Error 11001 connecting to redis: 6379. getaddrinfo failed. Nobody faced?
Subhonjon
Is it possible to use opencv in django rest framework?
Саша
What’s the point to use regex in urls.py
Mirco
Subhonjon
why not ?
Images need to be processed
Subhonjon
Ouail
Guys Django templates sources? Not GitHub
Mr Sourav
https://pastebin.com/VNViLT2f
Can anyone tell me how to render this encoded_result through html? I can get the value by printing it within if statement but outside it's not working.
Subhonjon
Mirco
shiva
Remove multiple projects at a time I written this ,this is not proper way I think can anyone tell changes
Saqib
✋
Saqib
Someone have django full of plz send me
Mirco
gadghimuradm
I only have half :(
gadghimuradm
Chandra
I want to export the Excel data into django model how to do that? And after iam updating that particular data in Excel file while exporting into django it automatically updates the data which are modified in django ?