Lone
Omair
Asif
Suggest best book for Django
Doragonsureiyā
Suggest best book for Django
Looking for Django tutorials? you can follow these three recommended ones:
* Official documentation and tutorial
* Tutorial from MDN
* Tutorial from django-girls
Melvin
Can anyone help me to create URLs using slug
Cesar
Cesar
https://docs.djangoproject.com/en/3.0/topics/http/urls/
Cesar
path('articles/<int:year>/<int:month>/<slug:slug>/', views.article_detail),
Melvin
i tried that but it doesn't work
Melvin
path('events/<slug:slug>/', views.detailview, name='detailview'),
Melvin
def detailview(request, slug):
events = get_object_or_404(Event,id=slug)
return render(request,'eventsdetail.html',{'events':events})
Melvin
But the url doesn't show the slug
It is like this
http://localhost:8000/events/5/
'5' changes for each object accordingly as its id
cj
Melvin
Yes
cj
Melvin
{% extends 'base.html' %}
{% block title %}
{{ events.name }} - {{ block.super }}
{% endblock %}
{% block breadcrumb %}
<div class="post_thumbnail post__item">
<img class="post__thumbnail__image" src="{{ events.image_thumbnail.url }}">
</div>
<li class="breadcrumb-item active">{{ events.name }}</li>
{% endblock %}
{% block content %}
<p>{{ events.description }}</p>
{% endblock %}
Melvin
this is the template
Melvin
def get_absolute_url(self):
url = reverse('detailview', kwargs={'pk': self.pk, 'slug': self.slug})
return url
Melvin
cj
Melvin
Okay
cj
do you have a repo if your project? I can't see where you're rendering the resulting URL where you want to show the slug
cj
$iductive
How to add Django admin calendar in my form
Melvin
Doragonsureiyā
How to add Django admin calendar in my form
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 firsts results
cj
$iductive
$iductive
Please help
cj
Please help
show what you've tried to do at least
$iductive
I have imported
from django.contrib.admin.widgets import AdminDateWidget but didn't worked
Melvin
Melvin
404
https://github.com/Melvin-Thomas-Dev/sanskriti-2020
akshay aka max
akshay aka max
what a talented bunch
akshay aka max
can anyone tell me if I should go with php or Django as a beginner?
Day
akshay aka max
Day
none
Then find another one that you are attracted to,
akshay aka max
oh
akshay aka max
okay
Melvin
Sagar
How to connect fronted to backend in django
Sagar
If my backend is django
Dave
wow ok
Melvin
After that I followed another tutorial.
Melvin
Simpleisbetterthancomplex
Sagar
I am new to django how to clone or run GitHub django project successfully
akshay aka max
akshay aka max
Melvin
what's this
It's a website I got the tutorial from
Just google it.
You will get the website
Melvin
Harshit
When creating our own authenticate function by overloading built in authenticate , we need to make some changes in settings.py how to do that and where should i keep my overidden function ?
Alex
RENGANATHAN
How to fix SMTP refuse resend problem
RENGANATHAN
Please ! Can anyone help to me??
Anonymous
Ssl cert error?
Alex
Nurbek
Guys! I can't set my custom domain(godaddy) with AWS Lambda. I read many docs and followed instructuons. I'm confused can u guys help me out
Abhay
I am fresher in django
How can i learn django
Can any one tell me and send me resources of django
maroong
Alex
Doragonsureiyā
cj
Any word?
@c0x6A ?
I went to sleep because it was night here, nvm, 11 hours has passed since then, have you solved your problem yet?
Melvin
Melvin
I am a beginner so cant comprehend someone the error messages
Melvin
You mean Change that to slug?
Melvin
Instead of events.pk?
Melvin
Yees
cj
also you have to overwrite the save() method in your Event model, to fill up the slug field, otherwise it will be empty
Melvin
Let me try that
I am presently traveling
I'll try this and get back asap