Anonymous
Django 2.1
inchidi
Django 2.1
run this code in your django shell from budget.models import Project for project in Project.objects.all(): print(f"http://localhost:8000/{project.slug}") it will print all urls which wont raise 404
Anonymous
http://localhost:8000/business-ventures http://localhost:8000/akash-kandpal
Anonymous
these links are working
Anonymous
BTW why is that I can't pass anything as slug? and passing these things only, though I created them earlier as the project.name
Anonymous
?
inchidi
you are the one who wrote project = get_object_or_404(Project, slug=project_slug) in views.project_detail() you should know how
you can pass anything as slug, but this part of your code will raise 404 if the slug passed DoesNotExists
Anonymous
you can pass anything as slug, but this part of your code will raise 404 if the slug passed DoesNotExists
Thanks. I got it know. User can take any project name and then this slug field will remove spaces and add the project name to the url and then so that users can see the details of their respective projects. Thanks for the help.
Anonymous
Hello everyone
Anonymous
I am new in this group,if someone has video tutorials of django, please share it with me. Thank you
Anonymous
Hello everyone
https://www.youtube.com/playlist?list=PL6gx4Cwl9DGBlmzzFcLgDhKTTfNLfX1IK
Anonymous
Thanks a lot @Inchidi @harrypotter0
Anonymous
How much time would learning django celery for basic background task will take
Vikas
https://www.youtube.com/playlist?list=PL6gx4Cwl9DGBlmzzFcLgDhKTTfNLfX1IK
Vikas
This is previous version of Django I want new version begginerz Django video plz send me a link g
Anonymous
https://www.youtube.com/playlist?list=PL6gx4Cwl9DGBlmzzFcLgDhKTTfNLfX1IK
check for the docs that are the best way to start. Djangoproject
Vikas
Okk g
inchidi
i found that using @override_settings(PASSWORD_HASHERS=['django.contrib.auth.hashers.MD5PasswordHasher']) in our unit test make a really big difference
Sanjay Krishnan
How much time would learning django celery for basic background task will take
https://simpleisbetterthancomplex.com/tutorial/2017/08/20/how-to-use-celery-with-django.html
Jose Luis
why updated = models.DateTimeField(blank=True, default=datetime.now) and updated = models.DateTimeField(blank=True, default=timezone.now)
Jose Luis
always save my local datetime instead UTC? is that OK?
Jose Luis
i want to store all the dates in UTC for compatibility :/
Jose Luis
is OK to use datetime.utcnow() ?
pino@mastrobirraio ~$
I guys i try to display some photos in a template. but the browser doesn't find the images. https://pastebin.com/MYemcamn
Mirco
You can check if path is as u expect in a django shell , by making that queries And check with console of your browser , in the network section if I don't go wrong, what path it calls
Mirco
Is that how you except or not ?
pino@mastrobirraio ~$
the outcome is the same if i remove the MEDIA_URL from the src parameter of the img tag
Mirco
When you upload the image, do you find it inside media/home/photos ?
pino@mastrobirraio ~$
yes
pino@mastrobirraio ~$
i think the problem is in the image path generated by the template engine
Mirco
Have you already installed Django Debug Toolbar ?
Mirco
Try with {{ photo.image_path.url }}} This attribute gives you url of your images
Shibin
From where I can freelance work based on python django other than from freelance.com
Shibin
Pls suggest me if anyone knows
Wang
hello everyone
Wang
how to only display all email in Django user model
Wang
i can use sql statement from email in user
Wang
right, but i don't know how to use it
Pradhvan
Check out the django girls docs
Pradhvan
It's great for starting
Wang
i want get a email of list
Wang
or email of tuple
Pradhvan
What does your models look like ?
Wang
it's django come user model
Pradhvan
Oh ! I thought. My bad 😃
Ghorz
Please depaste it
inchidi
i want get a email of list
[user.email for user in User.objects.all()]
Anonymous
How to click button on website with requests
Anonymous
Help me
Andrii
Did you hear smthing about screenshot?????
Wang
use a tag
inchidi
is OK to use datetime.utcnow() ?
use from django.utils.timezone import now to make it fit with your TIME_ZONE in settings.py
Mirco
pino@mastrobirraio ~$
Mmm strange
yes, is like it doesn't indentify that the url to generate is a path to a photo and not a path to a media
inchidi
try make it more normal with MEDIA_ROOT = os.path.join(BASE_DIR, 'media')
pino@mastrobirraio ~$
because you set MEDIA_ROOT = '/' ?
This is what i've written in settings.py MEDIA_ROOT = '/' MEDIA_URL = '/media/'
pino@mastrobirraio ~$
https://pastebin.com/maUFcde4 The pastebin is exipiring
pino@mastrobirraio ~$
is how it doesn't read these variables
inchidi
pino@mastrobirraio ~$
let me try
pino@mastrobirraio ~$
i've tried
pino@mastrobirraio ~$
Doesn't work
inchidi
share your media url like this again
inchidi
oh and reupload your image
inchidi
and the url?
pino@mastrobirraio ~$
i'm trying to reupload the images
pino@mastrobirraio ~$
doesn't work
inchidi
nice now add this urlpatterns = [......] + static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT) in your root urls.py
inchidi
you'll need these from django.conf import settings from django.conf.urls.static import static
pino@mastrobirraio ~$
django.core.exceptions.ImproperlyConfigured: Empty static prefix not permitted