Sooraj
Hello iam working on a new project, I wanna setup a logic the payment should expire after a month and give a message to user the subscription is over how can I set up this
I'm
Hi.
This is some lines of my code in a view:
project.state = requested_state
project.save()
serialized_project = ProjectSerializer(project)
return Response({"project": serialized_project})
And it says that Object of type ProjectSerializer is not JSON serializable.
Why isnt it JSON serializable and how can I fix that?
☯️
Hi there
I want to return boolean value in DRF api view as response
How can i do this? Can anyone help me?
Abhi
js
Hello guys,
I built a website using Django and I want to host it on pythonanywhere but it is not allowing me to upload because I used python version 3.11 which is not supported by it. Any idea please?
Шамиль
hi! Help please. I have a link that counts how many clicks there were. If it is written in the social network that there was a click on the link, but on my part the transition was not counted, does this mean that it was a bot that clicked?
Uk
Pato
js
Rom..
I'm confused in why we create abstract user model
Rom..
Abstract user?
I'm
🎒
Is it possible to deploy django project on wp hosting?
Ikki
Anand
hi guys , have you anyone worked in django connection pooling ? if so can i get a sample code in that
Charly
Anand
Connection to what?
i'm using django channels , BTW it loads my db , and sent's to a more connection error , inorder to handle that i planned to switch to adding a connection pooling in my django application
db_conf = {
'default': {
'ENGINE': 'django.db.backends.postgresql',
'NAME': 'my db',
'USER': 'user',
'PASSWORD': 'My Password',
'HOST': 'My Host',
'PORT': '25060',
'CONN_MAX_AGE': 60,
'OPTIONS': {
'keepalives': 1,
'keepalives_idle': 30,
'keepalives_interval': 10,
'keepalives_count': 5,
},
}
}
i just used the https://pypi.org/project/django-db-connection-pool/ package , but i need to get some examples code , have anyone worked with this or not !! hope am clear to you
Charly
i'm using django channels , BTW it loads my db , and sent's to a more connection error , inorder to handle that i planned to switch to adding a connection pooling in my django application
db_conf = {
'default': {
'ENGINE': 'django.db.backends.postgresql',
'NAME': 'my db',
'USER': 'user',
'PASSWORD': 'My Password',
'HOST': 'My Host',
'PORT': '25060',
'CONN_MAX_AGE': 60,
'OPTIONS': {
'keepalives': 1,
'keepalives_idle': 30,
'keepalives_interval': 10,
'keepalives_count': 5,
},
}
}
i just used the https://pypi.org/project/django-db-connection-pool/ package , but i need to get some examples code , have anyone worked with this or not !! hope am clear to you
No need for code example, Django manages connections for you
Charly
And of course use the settings shown in the link you sent
Anand
i tried that , but i dont see it typically fulfilling my need , any other alternative are there ?
Charly
Anand
We have been using IOT devices to get the data and store it in the DB, which takes more time to get the data, so the connections are open, within that timeframe another request is coming which make my db overloaded and throws the connection time out error . meantime the socket opens and closes parallel.
FATAL error am getting : remaining connection slots are reserved for non-replication superuser connections
Charly
Charly
What's the issue with pooling?
Anand
i mean , how it can be achieved without the use of this lib
Wanda
I want to implement Google login and signup functionality in my project plzz help me how can i do it?
Mirco
Wanda
I want to implement jwt also can I do it?
Wanda
Oki
vighnesh
Hey everyone,
I want to create a payroll dashboard using django , are you have something to help me
Doragonsureiyā
vighnesh
What should be the frontend look for that
Maxim
Thakur Praveen
Can anyone help me to revert last code changes on deployment in prod,how to do it?
Charly
Dullah
Hello everyone
I’m moving from sqlite3 to postgresql, i have successfully dumped the data buy i keep getting the error:
psycopg2.errors.CannotCoerce: cannot cast type time without time zone to timestamp with time zone
LINE1:…ted” TYPE timestamp with time zone USING “created”::timestam…
The above exception was the direct cause of the following exception:
…
django.db.utils.ProgrammingError: cannot cast type time without time zone to timestamp with time zone
LINE1:…ted” TYPE timestamp with time zone USING “created”::timestam…
i am using psycopg2-binary v2.9.9
クマル
hlo
クマル
while i pass data from django view to template
html web view shows blank
can anyone help me
Fahri
park seo joon
Tanzid
class UserRatingViewSet(viewsets.ModelViewSet):
permission_classes = [IsAuthenticatedOrReadOnly,]
queryset = models.UserRatingModel.objects.all()
serializer_class = serializers.UserRatingSerializers
filterset_fields = ['news__id']
authentication_classes = [TokenAuthentication]
def post(self, request):
serializer = self.serializer_class(data=request.data)
serializer.is_valid(raise_exception=True)
news_id = serializers.validate_data['news_id']
rating = serializers.validate_data['rating']
# user = self.request.user
try:
user = request.user
except:
print("User not found")
news = ArticleClass.objects.get(id=news_id)
rating_instance = models.UserRatingModel.objects.create(user=user, news=news, rating=rating)
return Response({
'data': rating_instance
}, status=status.HTTP_201_CREATED)
Error:
IntegrityError at /ratings/
NOT NULL constraint failed: UserRating_userratingmodel.user_id
Tanzid
Can any one help me to solve this probelm?
クマル
no any error
park seo joon
no any error
Trying return httpresponse objects and see if you have sam error if not, know that you didn't pass the data well and check your terminal for necessary information
クマル
Captain
I was trying to host Django project on VPS hosting of Hostinger anyone knows how to host it
Amir.M
Hello friends, I have an input in the form that is for a photo, I want to set a value in this input using the template language so that if the photo is not specified, the previous photo will be set.
But this does not apply, I used this in value.
{{post.images.first.image_file}}
park seo joon
park seo joon
Use attribute for that I usually use models for that
‹m›Javad‹/n›
park seo joon
You can use reverse and url you can also just pass in the url
iamdreamer
Can anyone share how to make a social auth in DJ REST Auth from axios.
iamdreamer
How to get id_token of google Oauth from NextAuth and pass using axios
Eben
I am working an two simple project. Nothing changes in both apps . let's say one is the clone of the other, but I'm hosting them separately.
I want both apps to use one database.
How do I go about it?
Georg
hi. sometimes celery won't change a status of task into SUCCESS of FAILED, so my parent task (who's waiting a group) can't exit from .get() and finish it's work. How to solve such deadlock?
Georg
meanwhile there is no any deadlock in a DB
Georg
it can happen sometimes, it can happen not..
‹m›Javad‹/n›
Do you guys know how to write a class for comments in views.py?
Madhur
What is the defer() and only(),?
I go through some of the docs, I didn't understand the use of this.
also youtube video are not available on this topic.
Please help me to understand
cj
Islomjon Sheraliyev
Hello guys! Does anyone knows how to put React.Js file into Django file?
Islomjon Sheraliyev
Andrey
Hello! How to get them together parler + mptt ?
‹m›Javad‹/n›
Guys, someone has the views code. To show a post and its comment and send a comment?
can you send🥲
‹m›Javad‹/n›
Doragonsureiyā
The code I wrote does not work in sending and displaying comments
Please provide a full explanation including all the details that you consider relevant. Your statement is too broad and there is no clear way to answer you, you have to explain:
- what you're doing
- what you're expecting
- what you're using
- where you're running the script
- what Python version you're using
- what packages and their versions you're using
- and the most important thing: show the code YOU wrote (read rule 5️⃣ for that)
and more details, that way your chances to get help will increase.