Mirco
Qwerty
use pastebin
Rose
User % has 1/3 warnings; be careful!
Reason:
Don't request private messages (rule #9)
ali
What's the package is good for the swagger generation of DRF?
Mirco
ali
Марк
Hi guys. Cant find the answer on the internet on this question - how can i limit amount of connections on certain consumer with django-channels? I am working with this library only a week, and can`t figure it out.
Example: maximum connections = 1, and if some client already connected, other connections will be rejected on handshake
Thank you
Anonymous
Марк
Yeah 😁, i already got answer from you guys, thank you
дамирка228
can we help, how should i study django productive?
Rose
can we help, how should i study django productive?
Looking for Django tutorials? you can follow these three recommended ones:
* Official documentation and tutorial (https://docs.djangoproject.com/en/dev/intro/tutorial01/)
* Tutorial from MDN (https://developer.mozilla.org/en-US/docs/Learn/Server-side/Django)
* Tutorial from django-girls (https://tutorial.djangogirls.org/en/)
дамирка228
thanks you bro ❤️
дамирка228
i m beginner and don’t search good videos for youtube, because i’m from russia - content in our country about programming etc👎🏿
Anonymous
#help. I need help. please
AttributeError at /shop/
'QuerySet' object has no attribute 'validate_number'
Mirco
Anonymous
share the code via pastebin
def Shop_Sidebar(request):
products = Products.objects.all()
# Set up pagination
p = Paginator(products, 6)
page = request.GET.get('page')
try:
product = Paginator.page(Products, page)
except PageNotAnInteger:
product = Paginator.page(1)
except EmptyPage:
product = p.page(p.num_pages)
return render(request, 'shop-left-sidebar.html',{'product':product, 'page':page})
Mirco
Anonymous
Mirco
Anonymous
Mirco
.
Isreal
How can deploy Django rest api to cPanel please
Rose
User Maximiliano Exequiel has 1/3 warnings; be careful!
Reason:
contextless link
Мефистофель
Hello. I will have 1 django website and 2 bots. I need a single point of connection to the database. I want to make a fast api async sqlalchemy database. but with bots, it's clear how to do it. But what to do with Django, is it a good tone, how will it affect the presentation-schema classes, is there a better solution or ready-made implementations?
Yan
Hello. How can I simply link postgresql to a django project without getting an error?
Charly
Of course
Hello
I have an error when I want to deploy my project with Gonicorn
This error
gonicorn.socket: Failed with result 'service-start--limit-hit'
Yan
Charly
Yan
FFDD35ADD
Hi everyone I’m starting learning django and I got a “secret_key” error I got the .env file where is stored the “SECRET_KEY VARIABLE” and when I run the code it says invalid line: SECRET_KEY
Sumit
FFDD35ADD
Poya
Hello.
I wrote an api that by giving a special token to the user, I can create a post that he has
Title, subtitle
There is, but now when I test the api it gives me this bug:
Incorrect configuration in /api/postlist/
The field name 'Title' is not valid for the 'Post' model.
I thought that the problem was caused by cors, which I had not set and could not recognize the local IP host.
But after setting it again it gives me the same bug
I want post related to user to be saved through token after user AUTH
But I still have bugs
.
Charly
nyctophile
hi guys,
i have a question
in post method i have a condition that deletes a group
and if that happens i want to redirect the user to home page
and i used this to redirect in that condition:
return redirect('home')
but there is another return which is this below for post function:
` return redirect(request.META['HTTP_REFERER'])
`
so when that condition works user is not being redirected to the home page and i having error GroupModel matching query does not exist.
so my question is how should i redirect user to the home page in that condition and why redirecting is not working in that condition?
https://hastebin.com/share/kisivuyazo.python here is my code if needed
Rose
Rule 5️⃣: To share code or error tracebacks, use an online pasting service like:
- https://dpaste.org
- https://hastebin.com
- https://nekobin.com
- https://bin.kv2.dev
If you posted a wall of text, go back and delete it.
Qwerty
Poya
nyctophile
nyctophile
nyctophile
nyctophile
Qwerty
i did add this to my urls.py and add main to every url but still having same issue
you need to add the app_name variable to the URL file of your application and specify the name, then to identify the route you can write the name of the application and then the name of the route. I showed you the example above, just change the "anytning" to the desired name.
if u are using the "main" app name, so yr urls file should look something like this
app_name = 'main'
urls_patterns = [path(..., name='home')
and the redirect function:
redirect('main:home')
that's all
nyctophile
nyctophile
nyctophile
Qwerty
clouded
Next thing is we speak English only here. That's rule #1.
Rose
User Udhay has 1/3 warnings; be careful!
Reason:
Speak English only! (rule #1)
Rose
User Udhay has 2/3 warnings; be careful!
Reason:
Speak English only! (rule #1)
clouded
See, patience can end.
clouded
One more warning and you'll be banned.
Dj - 505
Hello ..My static files work fine on development enviroment, but when deployment on render (free plan) and doing collectstatic, the static files( photos) not shown ! How i solve this phroblem ?
clouded
amin
can we use DRF viewsets in templates ?
Rose
Rose
User Shreya has 1/3 warnings; be careful!
Reason:
rule #10 violation
ㅤ
Hello,
What is the best Python and Django course channel?
DreamDev007
from django import forms
class StudForm(forms.Form):
Stud_name = forms.CharField()
marks = forms.IntegerField()
def clean_Stud_name(self):
value = self.cleaned_data.get('Stud_name')
if value == 'aa':
raise forms.ValidationError('Enter correct name')
return value
DreamDev007
some one please help me with above code
DreamDev007
its not throwing custom field validation
DreamDev007
im using Django 4.2
DreamDev007
just dummy validation for my learning purpose..
I entered aa in text box.. still not throwing up any error on submitting
DreamDev007
Qwerty
class StudForm(forms.Form):
stud_name = forms.CharField()
marks = forms.IntegerField()
def clean_stud_name(self):
value = self.cleaned_data.get('stud_name')
if value == 'aa':
raise forms.ValidationError('Enter correct name')
return value
that's don't work for u?
1. do the field names match your template?
2. did you print the value into the console?
DreamDev007
No not working
I tried again with below.. still issue exists..
from django import forms
class RegisterForm(forms.Form):
name = forms.CharField()
addr = forms.CharField()
def clean_name(self):
val = self.cleaned_data.get('name')
if len(val) < 4:
raise forms.ValidationError('Enter Valid Name')
return val
Qwerty
DreamDev007
sure
DreamDev007
yeah.. might be some problem in form...
from django.shortcuts import render
from .forms import RegisterForm
# Create your views here.
def StudView(request):
form = RegisterForm()
my_dict = {'form':form}
if request.method=="POST":
form = RegisterForm(request.POST)
if form.is_valid():
print('name', form.cleaned_data['name'])
print('name', form.cleaned_data['addr'])
else:
print('not valid')
return render(request, 'modelapp\home.html', context=my_dict)
DreamDev007
its going for else part: not valid
DreamDev007
<!DOCTYPE html>
<html>
<head>
<title>Register</title>
</head>
<body>
<form method="POST">
{{form.as_p}}
{% csrf_token %}
<input type="submit" name="submit">
</form>
</body>
</html>