Charly
Admin
Charly
Admin
user is enabled?
Thank you very much, problem is solved.I enabled user and could log in to admin site
OmarHafiz87
@TRAXCUTTER Thanks 👍
❤AGh❤
Hello everyone,when i try to create custom user ,i get an integrity error ,how to fix it?
❤AGh❤
Type error:integrity error
Foreignkey constraint failed
Shahram
i have a problem
Shahram
i get this error
Shahram
NoReverseMatch at /
Reverse for 'single' with no arguments not found. 1 pattern(s) tried: ['blog/post/(?P<pid>[0-9]+)/\\Z']
arad
Define an app_name for the app in which you defined your url
arad
And then use this code inside the html
Shahram
my urls: path('post/<int:pid>/',single, name="single"), my views :def single(request, pid):
date_time = timezone.now()
post = get_object_or_404(Post, status=1, id=pid, published_date__lte=date_time)
context ={"post":post}
return render(request, 'blog/blog_single.html', context) and my html link each post href={% url "blog:single" pid=post.id%}>
arad
arad
Do you have another app?
Mobin
Shahram
Shahram
Doragonsureiyā
ja
Rule 5️⃣: Never post walls of text or screen photos. Use paste bins like https://dpaste.org, https://hastebin.com, https://bin.kv2.dev or your favorite one!
Shahram
arad
ja
I'm sorry bro, I don't know anymore
Shahram
arad
Shahram
https://dpaste.org/5gxwf
sanchit
Forbidden: /assessor/save-qa/
"GET /assessor/save-qa/ HTTP/1.1" 403 58 can anyone help me to fix this issue .
Bayram
Bayram
Priyanka
does any one have django project
Priyanka
A lot of errors occur if the internet or github is taken
Priyanka
I have created the project and it is getting an error
Saturn
Priyanka
Value error AES length is incorrect
Ibrohim
I want to register, or expand the standard user model, what is the best way to do so that this project can be immediately inserted into some project?
Mirco
Ibrohim
nizzer
nizzer
I have the table that contain item of the same name with different price but I need to get the average price in my model.... Can anyone help me
Mirco
Ibrohim
Django Allauth docs is well done
Views
Social Connections
URL name:
socialaccount_connections
The allauth.socialaccount.views.ConnectionsView view over at /accounts/social/connections/ (URL name socialaccount_connections) allows users to manage the social accounts tied to their local account.
Ibrohim
Mirco
i didn’t find it
https://docs.allauth.org/en/latest/socialaccount/advanced.html
Ibrohim
Mirco
Tim
Hello everyone!
Please tell me if it is possible to do this.
My script collects data from forms entered by the user, 3 and 4. And in response I need to return 3 + 4 = 7. On a new page of the site. To do this, do you have to write the data to the database or can you process it and return the response right away?
Ibrohim
Mehrdad
Kajal
ValueError: Field 'id' expected a number but got '4/'.
[14/Jun/2024 21:07:59] "GET /add-to-cart/?prod_id=4%2F HTTP/1.1" 500 132206
Can anyone help me to fix this issue
Anonymous
Anonymous
Kajal
path('add-to-cart/',v.add_to_cart,name='add-to-cart'),
Kajal
Kajal
Anonymous
Yes
Please give me that url.
Kajal
<form action="/add-to-cart" class="d-inline">
Anonymous
Anonymous
Please show me form.py content
Anonymous
Then please show me views.py content
Anonymous
which is related to add-to-cart
Anonymous
Uk
I have idea, We can build our website community
Doragonsureiyā
Rule 5️⃣: Never post walls of text or screen photos. Use paste bins like https://dpaste.org, https://hastebin.com, https://bin.kv2.dev or your favorite one!
Sam
this is my view to filter my courses:
class CourseFilterView(APIView, PageNumberPagination):
def get(self, request):
paid = request.GET.get("paid")
sort = request.GET.get("sort")
size = request.GET.get("size", 1)
self.page_size = int(size)
q = request.GET.get("q")
courses = Course.objects.all().order_by("-created_at").distinct()
# Filtering Starts from here
if q:
courses = courses.filter(title__icontains=q)
if paid:
courses = courses.filter(costly=True)
if sort = 'new':
courses = courses.order_by("-id")
paginated_queryset = self.paginate_queryset(courses, request=request)
serializer = serializers.CourseSerializer(paginated_queryset, many=True)
total_results = courses.count()
return Response(serializer.data)
and i have another view to clear my filters, except the q, page and sort parameters:
class ClearFilterView(APIView):
def get(self, request):
url_path = request.GET.get("url_path")
parsed_url = parse.urlparse(url_path)
# query_params is not cleared
query_params = parse.parse_qs(parsed_url.query)
# we have to keep only the parameters which are needed like page, q and sort
cleared_queries = {k: v for k, v in query_params.items() if k in ["page", "q", "sort"]}
# After that we must request to the CourseFilterView class to filter the courses again, So
# We have to change the cleared_queries which is a dictionary to a query because HTTP GET queries do not
# accept dictionary, like: {'page': ['1'], 'q': ['python']} = ?page=1&q=python.
# queries is cleared
queries = parse.urlencode(cleared_queries, doseq=True)
new_url = f"/course/filter-data?{queries}"
now my problem is i don`t know how can i pass this get parameters to my CourseFilterView to filter the products again!
Sam
this is my view to filter my courses:
class CourseFilterView(APIView, PageNumberPagination):
def get(self, request):
paid = request.GET.get("paid")
sort = request.GET.get("sort")
size = request.GET.get("size", 1)
self.page_size = int(size)
q = request.GET.get("q")
courses = Course.objects.all().order_by("-created_at").distinct()
# Filtering Starts from here
if q:
courses = courses.filter(title__icontains=q)
if paid:
courses = courses.filter(costly=True)
if sort = 'new':
courses = courses.order_by("-id")
paginated_queryset = self.paginate_queryset(courses, request=request)
serializer = serializers.CourseSerializer(paginated_queryset, many=True)
total_results = courses.count()
return Response(serializer.data)
and i have another view to clear my filters, except the q, page and sort parameters:
class ClearFilterView(APIView):
def get(self, request):
url_path = request.GET.get("url_path")
parsed_url = parse.urlparse(url_path)
# query_params is not cleared
query_params = parse.parse_qs(parsed_url.query)
# we have to keep only the parameters which are needed like page, q and sort
cleared_queries = {k: v for k, v in query_params.items() if k in ["page", "q", "sort"]}
# After that we must request to the CourseFilterView class to filter the courses again, So
# We have to change the cleared_queries which is a dictionary to a query because HTTP GET queries do not
# accept dictionary, like: {'page': ['1'], 'q': ['python']} = ?page=1&q=python.
# queries is cleared
queries = parse.urlencode(cleared_queries, doseq=True)
new_url = f"/course/filter-data?{queries}"
now my problem is i don`t know how can i pass this get parameters to my CourseFilterView to filter the products again!
I did fix it
Kanji
Hy can I able to add the multipel image in one time if possible send the forms.py file code
Kanji
I want to add the multiple image so I make the two model first for product and second for image
Kanji
Nicolas
Hi guys, I need help with something stupid. I need to delete from my admin panel in Django, a few options
Nicolas
How can I delete them? (I don’t want to have them in my search toolbar)
I don’t know if I explain correctly my issue
Kanji