Alex
Faraaz
i deployed my django app on pythonanywhere everything runs fine but when I open my admin panel there are no styles only simple html file, but I run it on my local port it opens with styles too
Why?
Artyom
Faraaz
Yes I did
Artyom
Faraaz
Yesss
Gagan
Artyom
It must be something with staticfiles
Faraaz
Gagan
It's not able to resolve static urls
Gagan
https://docs.djangoproject.com/en/4.0/howto/static-files/#serving-static-files-during-development
Faraaz
Didn't work
Gagan
Which webserver are you using serve static files
Rushikesh
Yeah that's possible
Do u suggest any module for message broadcast to all the clients connected to given channel??
kmk
guys, tell me please. Here I have a GET to get a post by its id.
class PostView(generics.RetrieveAPIView):
serializer_class = PostSerializer
permission_classes = [IsAuthenticated]
queryset = Post.objects.all()
now i have a bookmark view.
class PostBookmarkView(generics.CreateAPIView):
serializer_class = BookmarkSerializer
def create(self, request, pk):
bookmark = Bookmark(post=pk, user=request.user)
bookmark.save()
ser = self.serializer_class(bookmark)
return Response(ser.data)
def delete(self, request, pk):
bookmark = Bookmark.objects.get(post=pk, user=request.user)
bookmark.delete()
How do I add when I receive a post whether it is bookmarked to my user or not?
Sushant
Guys can anyone tell me
How to save model form choice field in databass
Mamad
hello everyone, i have a class containing static information like below
class CommunicationT(ChoiceHelper):
WEBSITE = pgettext_lazy('text', ' Site')
FORM = pgettext_lazy('text', 'Form')
is there anyway to get a dictionary of these constants the way one can get _init_ attributes using _dict_
i want to pass the dictionary using the restfull API eventually
Luke
Hello fam who can teach me how to write payment gateway request and response?
Sergey
Hello there! I work with DRF and i want to make field from query, but i cant do it through property (because of some circle imports), so how can i do it properly, such this will be shown in swager?
hi everyone
what is standard way to get refresh token and access token in jwt authentication?
i edit dj-rest-auth package codes and save refresh token in a database😅😅
is this way secure?
Sergey
For JWT it's not recomended to store in DB, it's only stored (basicly) on client side
Shainkey
For jwt we can fetch all the information and stored in db and get token from django site to validate the user. It's stored only client side
Shainkey
Anyone have any idea about stripe integration in django
Shainkey
Please let me know
I missed some steps
Shainkey
I got the successful response and able to call the api but from backend side I need to check success payment, failure and stored all the information in db.
Aakash
Charly
Sanchit
Hii....can anyone explain me how to create multiple type of user through single registation form in Django
Django
Tensor
bulk_create
Not multiple user, multiple type of user
Django
Tensor
Django
Just put the fields you want to register user, and in models , define that fields with blank=True
Django
And that's it, your multiple types of user will get create
Tensor
Why do we need bulk create in that?
Tensor
The form will give us only one user
Django
Then put optional fields
Tensor
Django
Tensor
Also create two views with action = blank , this will create a post request to the same url
Tensor
Render same form in both views
Django
Yes but that logic will get implement in one view also
Tensor
Yeah but to keep it encapsulated
Django
That's also fine
Tensor
Debugging would never cross between users of diff types
Tensor
Also if you want to perform some action for one type and not for other, the if else blocks will just make it ugly
Django
Tensor
Why not?
Diman
class FilteredBioListView(ExportMixin, SingleTableMixin, FilterView):
table_class = BiomTable
model = Biom_accord_service
template_name = "biom/biom.html"
# export_formats = ("csv", "xls")
filterset_class = BiomFilter
export_formats = ("csv", "xls")
# def get_queryset(self):
# return super().get_queryset().select_related("location")
def get_table_kwargs(self):
return {"template_name": "django_tables2/bootstrap.html"}
Diman
how to protect in the template? please
Diman
{% extends 'base.html' %}
{% load static %}
{% block body %}
{% load bootstrap4 %}
{% load render_table from django_tables2 %}
{% if filter %}
<form action="" method="get" class="form form-inline">
{% csrf_token %}
{% bootstrap_form filter.form layout='inline' %}
{% bootstrap_button 'Поиск' %}
</form>
{% endif %}
{% render_table table %}
{% endblock %}
</html>
Diman
{% if user.is_authenticated %}
Diman
is not working
Diman
do I have to do it through context?
Diman
???
Maxim
???
https://t.me/django/211257
Bright
I want to build a multi vendor ecommerce, please what are the functionalities that I must add to make it look unique
Данило
If i have django project, could i take normal html, css and js files? Like, with ordinary syntax
👑 Dharmzeey
demon
should i disable csrf token if i'm using token authentication
👑 Dharmzeey
Please
I have a page whereby a user performs a click and then the view redirects back to that page,
The problem is that the page keeps stacking on one another as the user performs the click function.
Please is there a way to prevent the page from stacking when it redirects
Vaibhav
Is there a way to optimise admin list view ... We have more than 6 million records and if we use any search filter, it breaks due to order by and limit condition due to pagination
Kenechi
Vaibhav
Kenechi
Diman
thanks
Diman
from django.contrib.auth.mixins import LoginRequiredMixin
class MyView(LoginRequiredMixin, View):
Anshul
Hii I'm new to Django but not in Python
I'm stuck at giving path url and that why i'm getting 404 Status can anyone help me please.
It's a task of 1 min for you.
Charly
Anshul
My url is not given properly I guess
Anshul
you want my url code?