Axmadullo🦁
path('courses/subject/about/', anotherView), path('courses/subject/info/<int:pk>/', anotherView),
.
Guys, are u trolling
.
Its just wasting time
.
Read rules firstly and use fcking pasta
Aryan
anything?
.
?
Aryan
huh
Axmadullo🦁
This fcking guy does not show his view code, why u r trying to help
I was forbidden to send pictures here, so I'm sending a test
.
Omg, read rules
.
!paste
Doragonsureiyā
Rule 5️⃣: To share code or error tracebacks, use an online pasting service like: - https://del.dog - https://dpaste.org - https://linkode.org - https://hastebin.com - https://bin.kv2.dev If you posted a wall of text, go back and delete it.
Axmadullo🦁
// views.py ​ def dataSubjects(request): subjects = '', error = '' if Subject.objects.all().count() == 0: error = 'No subjects' else: subjects = Subject.objects.all() ​ return render(request, 'subject.html', { 'subjects': subjects, 'error': error, }) ​ ​ def anotherView(request, pk): subjects = Subject.objects.all(pk) return render(request, 'about.html', { 'subjects': subjects, }) ​ urls.py ​ from courses.views import dataSubjects, anotherView ​ urlpatterns = [ path('courses/subject/', dataSubjects), path('courses/subject/about/', anotherView), path('courses/subject/info/<int:pk>/', anotherView), ]
Axmadullo🦁
my code
Axmadullo🦁
Where may be my mistake?
Akhmad Osmanov
subjects = Subject.objects.all(pk) ????
Axmadullo🦁
Yes
Akhmad Osmanov
Subject.objects.filter()
Axmadullo🦁
I watch in video
.
I watch in video
You should read official documentation
.
Not fcking videos
Alex
Where may be my mistake?
https://t.me/django/172649
Axmadullo🦁
You should read official documentation
You are right, But I buy one course
Axmadullo🦁
And I learn Python Django by this course
Alex
And I learn Python Django by this course
You should learn python BEFORE django
Alex
not after or during
Axmadullo🦁
I have finished learning Python
Axmadullo🦁
And Start Leaning Django
Seth
hi guys, can you do a form autofill in django? to fill itself just by typing the pk?
Seth
I've said everything is possible with good API.
Could you tell me a little more about that please.
Alex
Could you tell me a little more about that please.
Whatever you want, it seems that it requires frontend programming.
!ALIEN
Hey guys, I have recently hosted Django applications on Azure.. With whitenosie, Azure is able to server css, js static file but not image file?
!ALIEN
Any idea why?
Manjunaath
?
!ALIEN
Did u keep debug as false ...
Its just not severing image file in static folder (I have tried collectstatic), but it is serving css, js
Anonymous
class ProductDetailView(View): def get(self: View, request, pk): product = Product.objects.get(pk=pk) return render(request, 'app/productdetail.html', {'product': product})
Anonymous
Get is not taking properly showing error
Anonymous
But Syntex is right
Ashutosh
I think remove view from second line
5P34R
def get(self: View, request, pk) self: ?
Alex
I think remove view from second line
a good point, but unrelated to his question.
Anonymous
I removed view too but then also showing error
Ashutosh
Self also remove
Alex
Self also remove
🤦‍♂️
Ashutosh
def get(request,pk):
Anonymous
def get(self: View, request, pk) self: ?
Bro get syntax is self , request , pk
Anonymous
But I didn't understand why not working
Ashutosh
Send the error msg which is showing on the terminal
Anonymous
Ok
Anonymous
Sending media is not allowed in the group
Doragonsureiyā
Sending media is not allowed in the group
Rule 5️⃣: To share code or error tracebacks, use an online pasting service like: - https://del.dog - https://dpaste.org - https://linkode.org - https://hastebin.com - https://bin.kv2.dev If you posted a wall of text, go back and delete it.
Anonymous
Hello, how can I give https access to Django Channels? My website could not connect to the web socket. In fact, https only has this problem. what's the solution? Mixed Content: The page at 'https://fo.bar/ws/dashboard/' was loaded over HTTPS, but attempted to connect to the insecure WebSocket endpoint 'ws://fo.bar/ws/dashboard/'. This request has been blocked; this endpoint must be available over WSS.
Javokhirbek
Hey everyone, my user serializer is not hashing the password? set_password is not working in my serializer. What do I have to do?
Hilariyus
Hey amigo's how to add login and register to an django project
Doragonsureiyā
Hey amigo's how to add login and register to an django project
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
Vicky
I have separate python code with multiple functions define in a class and I want to execute that code in Django .. how to do that ?
Arunkumar
[<name:Arun>,<name: Tony>,<name:Mike>] Which type of data type is this in python? And how to convert it into list?
Aneesh
I am using mqtt paho. Is it possible to wait for the message without giving a time.sleep. when we I publish and wait for the return message
Сергей
is there way to customize model of any django molule, without copy the module to my poroject directory?
Nayan
Hi i have a form when i click on it everytime it is throwing me the error str returned non string (type none ) It works fine at my development server but throws error on live server Anyone can help ?
Anatolie
Hi, help me with smtp gmail django
Jasurbek
class Category: title = models.CharField() class Item(models.Model): category=models.ForeignKey(Category, on_delete=?) what can I do so when Category is deleted its title will be written on Item's category
Alex
class Category: title = models.CharField() class Item(models.Model): category=models.ForeignKey(Category, on_delete=?) what can I do so when Category is deleted its title will be written on Item's category
Doesn't sound as clean design for me. If Category titles are unique (I guess they are), you could set them as pk instead of id. So every Item will carry the title of linked category. But much straightforward approach will be simply not to delete categories, but created a field "removed" or "deleted" to mark it as deleted.
Alex
is there way to customize model of any django molule, without copy the module to my poroject directory?
If a package suggests customization, it usually provides a set of specific abstract models. Like with builtin User for example: https://github.com/django/django/blob/7afca03c4058c25f2e1cec8d0b07c2157c93e831/django/contrib/auth/models.py#L321-L386
Alex
I got your point. I ve added a status property and if it is 0 then it is deleted, and in item on_delete=models.PROTECT. is it right approach?
Not bad. In my practice they usually make this field datatime, so you can filter such records in time.
Asdf
Any good resources for django rest framework?