DN
While trying to migrate, I'm getting an error ... ImproperlyConfigured....... Issue is probably caused by a circular import. Plz help
Domain
Sending media is not allowed on the group
Doragonsureiyā
Sending media is not allowed on the group
To share code or error tracebacks, use a pasting service, like: - https://linkode.org - https://dpaste.org
Shafin
Hi I need to create a role base login am beginner in django so please help me login like Admin Employee Manager Like this type of
Domain
https://linkode.org/#avRL4zjJk9jarvrgC4NAu4
Domain
you can do so with the built-in auth system in django
Domain
just add few restrictions to match the role you're authenticating
Ted
Hi so I want to know how i can fix this the website I want to use keeps re-redirecting me to a homepage url that isn't on the website but from another website instead.
spa44ow
I want to deploy my django react application in aws ec2.. which is the best option? Through an apache server..or direct deployment?
Masoud
hi I deployed my django project on a cpanel host. The problem is that each time a new user(session) requests, whole project is started from the beginning, even all of libraries are loaded again (e.g. just spacy library takes 1 second to load for each new user) and my website is very slow. Is there any way to solve this problem?
Ayush
Someone has Django course, please provide me
Абдулазизов
Have someone done multilingual web app in django That translates model and html static files also
Doragonsureiyā
Someone has Django course, please provide me
Looking for Django tutorials? you can follow these three recommended ones: * Official documentation and tutorial * Tutorial from MDN * Tutorial from django-girls
K(RANA)
TypeError at /admin/auth/user/1/delete/ str returned non-string (type User) -This kind of error is coming when I want to delete some user....anybody fix it
Anshu
Are you not getting the query_set??
Абдулазизов
Read i18n topic on official docs
Have you ever used that i cannot it did not work as well as i expected
Mirco
Have you ever used that i cannot it did not work as well as i expected
It depends on what does not work for you I use it everytime in every project
Mirco
the documentation is clear enough. study it
Anonymous
How to integrate firebase social media authentication in django rest framework
Doragonsureiyā
How to integrate firebase social media authentication in django rest framework
Step 1: Open a browser Step 2: Write down https://google.com or https://duck.com and press Enter Step 3: In the search box, write down the same words you asked here Step 4: Read the first results
Ted
Hi so my base url is some how 127.0.0.1:8000/blog/ could someone help me change it back somehow to being 127.0.0.1:8000 only
Mr Sourav
Hi I've a problem with hx-delete in django htmx. Item is not clickable there. If anyone uses htmx then please tell me I'll share the code
Mr Sourav
start sharing the code via pastebin it's more useful
https://pastebin.com/p6kXxerM This code works fine when I use normal html instead of htmx. With htmx delete button isn't clickable. But with inspect element I can see this refers to the delete link.
Mirco
inside the url change from str:pk to int:pk instead of BlogPost.objects.get(id=pk) use get_object_or_404(BlogPost, id=pk)
Fan / Ac
Hi mirco, can you make some suggestion on this topic https://t.me/django/191489
Mirco
but at least you start having a good code
Mr Sourav
but at least you start having a good code
I know these bro. I'm just practicing some. If str works or not, int works or not... Like these... That's not the point
Mr Sourav
Can you help me why that item isn't clickable?
Mirco
I know these bro. I'm just practicing some. If str works or not, int works or not... Like these... That's not the point
yes, it's also the point because it helps understanding Django good practice 😊
Mirco
Can you help me why that item isn't clickable?
https://htmx.org/examples/delete-row/ follow the documentation, the hx-target does not have to point to a url -> https://htmx.org/attributes/hx-target/
Mirco
@pyflare
could u stop tagging me ?
Fan / Ac
sorry will do
Mirco
sorry will do
didn't get what u asked for in that message
Fan / Ac
didn't get what u asked for in that message
i have a api which get some data from db, a view which display that data, so i like to know is there are direct way to call the api from the view if the api is not in same app as the view i see people do this https://stackoverflow.com/questions/11663945/calling-a-rest-api-from-django-view
Fan / Ac
the API is an external one or you developed that endpoint with DRF ?
the api exist in the same app, and i have created a small api without DRF
Mirco
the api exist in the same app, and i have created a small api without DRF
and why calling it inside the view ? just call the API via javascript and show data in your template
Mirco
you don't need a view, you already have a view ( the API endpoint view ) you just need a TemplateView to render the template
Mr Sourav
https://htmx.org/examples/delete-row/ follow the documentation, the hx-target does not have to point to a url -> https://htmx.org/attributes/hx-target/
Thanks bro. It has been solved by replacing id with URL at hx-target. Btw, I agree with your best practice things.
Anonymous
how to add extra field in model serializer which is not related to any model
Ted
go to urls.py and cgange it to empty string
the urls have this: #Add URL maps to redirect the base URL to our application from django.views.generic import RedirectView urlpatterns += [ path('', RedirectView.as_view(url='/blog/')), ]
Anonymous
just define it
class CategoryCreateSerializer(ModelSerializer): parent_id = SerializerMethodField(read_only=True) class Meta: model = Category fields = ('name', 'parent_id') def create(self, validated_data): print(validated_data)
Anonymous
but doesnot get parent_id
Subhasis Khuntia
def createRoom(request): form =RoomForm() if request.method =="POST": form=RoomForm(request.POST) if form.is_valid(): form.save() return redirect("home") context={"form":form} return render(request, "base/room-form.html",context)
Subhasis Khuntia
i am new to django I want to know the flow of this program
Subhasis Khuntia
in this function the request is rendered then it redirect
Mirco
i am new to django I want to know the flow of this program
it's just a form submit if submit is ok , it will redirect to home page
Subhasis Khuntia
But in the normal function if the return statement excute it go out of the function
Mirco
But in the normal function if the return statement excute it go out of the function
if the form is ok , it will redirect to home page the second return instead is to render the form
cj
but the second return is excuted first
just read the code and follow it, and you'll understand what's happening there
Anshu
but the second return is excuted first
No, if request is post, the if part will be executed
Anonymous
you have to define the method def get_parent_id(obj)
def get_parent_id(self, obj): return obj but same problem
Anonymous
you have to define the method def get_parent_id(obj)
'dict' object has no attribute 'parent_id' i have add obj.parent_id but same problem
Subhasis Khuntia
obvs
can u explain why it's so?
Mirco
can u explain why it's so?
because the first one is a GET request ( when you go to the page where the form will be shown ) then. when u submit the form you send a POST and you will enter inside the if statement
Fan / Ac
you don't need a view, you already have a view ( the API endpoint view ) you just need a TemplateView to render the template
i got what you said, first i thought how to display template without view, now i get you since you said about template view