About Server Images and media folder

2023-06-14 Thread Aditya Desle
Hello Everyone, 
I have a React + Django App.
Deployed on digital ocean server/droplet.

Everything is working fine on local system and server too. But the issue 
i'm facing is about images.
I have multiple folder in media folder and the when i call the post request 
to add the images, the images doesn't get stored in folder 
I have applied and configured the nginx file too.
Still facing same issue 
The post request on server side get called perfectly still the images 
aren't getting stored inside the folder.




-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/889bd123-bb89-4e95-b608-cef7c2bebf45n%40googlegroups.com.


Re: Can't load the images

2023-05-28 Thread DieHardMan 300
1. Make sure that django.contrib.staticfiles is included in your 
INSTALLED_APPS 

2. also if it already included, adding the following snippet to your urls.py
:
---
from django.conf import settings
from django.conf.urls.static import static

urlpatterns = [
# others urls,
] + static(settings.STATIC_URL, document_root=settings.STATIC_ROOT)
---
3. also in your settings.py adding STATIC_ROOT, make sure you have 
"pathlib" imported above:
---
from  pathlib import Path
# ...
# ... other code
# ...
STATIC_URL = "static/"
STATIC_ROOT = Path.joinpath(BASE_DIR, STATIC_URL)
---
or if you prefer os module adding this instead in settings.py
---
import os
# ...
# ... other code
# ...
STATIC_URL = "static/"
STATIC_ROOT = os.path.join(BASE_DIR, STATIC_URL)
---
Although this is not suitable for production, only for development.
for production -> 
deployment https://docs.djangoproject.com/en/4.2/howto/static-files/deployment/
I hope this help.
ในวันที่ วันเสาร์ที่ 27 พฤษภาคม ค.ศ. 2023 เวลา 23 นาฬิกา 28 นาที 21 วินาที 
UTC+7 Ramesh Parajuli เขียนว่า:

> Please help me:

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/a27080c6-bdbc-4c7b-9f6e-9817bf0496e1n%40googlegroups.com.


Re: Images are not showing up in the page

2023-04-09 Thread Sahan Srinivas
Yeah thanks everyone, the problem is resolved.

On Sun, Apr 9, 2023 at 5:19 PM Kiyavilo Msekwa  wrote:

> If you are running it on a live server make sure that media/photos folder
> is on public_html before you run load %satic% since the access to the
> domain will look into public_html folder to which Django does not run from.
>
> I had previously encountered similar situation and the solution was to
> copy the folder into public_html instead
>
> I hope this answer the question.
>
> Regards
>
> Kiyavilo
>
> On 9 Apr 2023, at 22:52, Sahan Srinivas <26sa...@gmail.com> wrote:
>
> Yeah I gave that, actually that is also not the problem. Not sure what it
> is
>
> Kind Regards,
> Sahan
>
> On Sun, Apr 9, 2023 at 3:44 PM Mir Junaid  wrote:
>
>> The command is {% load static%}
>>
>> On Sun, 9 Apr, 2023, 11:45 pm Sahan Srinivas, <26sa...@gmail.com> wrote:
>>
>>> Hi Devs,
>>>
>>> *Images are not showing up in Django. Below is the screenshot*
>>>
>>> 
>>> *Below are the screenshots of Settings.py file and urls.py files*
>>>
>>> *settings.py*
>>> 
>>>
>>> *urls.py*
>>> 
>>> *home.html:* (I have give like this in html file)
>>> 
>>> *views.py*
>>> 
>>> *Media Images:*
>>> 
>>>
>>> *I followed the documentation, stack overflow but, I am still not sure
>>> why images are not showing up. Can anyone help me out?*
>>>
>>> Kind regards,
>>> Sahan
>>>
>>>
>>> --
>>> You received this message because you are subscribed to the Google
>>> Groups "Django users" group.
>>> To unsubscribe from this group and stop receiving emails from it, send
>>> an email to django-users+unsubscr...@googlegroups.com.
>>> To view this discussion on the web visit
>>> https://groups.google.com/d/msgid/django-users/CAO3SeezAm3Lbe8JGxoCrZ2DCd74p8gFsxzUUoLa5166t6Dm9Kg%40mail.gmail.com
>>> <https://groups.google.com/d/msgid/django-users/CAO3SeezAm3Lbe8JGxoCrZ2DCd74p8gFsxzUUoLa5166t6Dm9Kg%40mail.gmail.com?utm_medium=email_source=footer>
>>> .
>>>
>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "Django users" group.
>> To unsubscribe from this group and stop receiving emails from it, send an
>> email to django-users+unsubscr...@googlegroups.com.
>> To view this discussion on the web visit
>> https://groups.google.com/d/msgid/django-users/CAM%2BpT8z6w2Pjs6Hb_CxrOvoWSNhYe4SoL3RrTpkp7pHEXr2spg%40mail.gmail.com
>> <https://groups.google.com/d/msgid/django-users/CAM%2BpT8z6w2Pjs6Hb_CxrOvoWSNhYe4SoL3RrTpkp7pHEXr2spg%40mail.gmail.com?utm_medium=email_source=footer>
>> .
>>
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/CAO3SeeyoR-A%3DW7f0fC-NjLZcqyG-m4oMVoqonQ7r_XmAoaEEMg%40mail.gmail.com
> <https://groups.google.com/d/msgid/django-users/CAO3SeeyoR-A%3DW7f0fC-NjLZcqyG-m4oMVoqonQ7r_XmAoaEEMg%40mail.gmail.com?utm_medium=email_source=footer>
> .
>
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/FD4AD59E-9002-46D9-97AB-41DB5B9E4E3D%40gmail.com
> <https://groups.google.com/d/msgid/django-users/FD4AD59E-9002-46D9-97AB-41DB5B9E4E3D%40gmail.com?utm_medium=email_source=footer>
> .
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAO3SeewM5VGZGNn-ruSToDUPifu85MPLLd5nCeDfw7SSNuNTFg%40mail.gmail.com.


Re: Images are not showing up in the page

2023-04-09 Thread Kiyavilo Msekwa
If you are running it on a live server make sure that media/photos folder is on 
public_html before you run load %satic% since the access to the domain will 
look into public_html folder to which Django does not run from.

I had previously encountered similar situation and the solution was to copy the 
folder into public_html instead

I hope this answer the question.

Regards

Kiyavilo

> On 9 Apr 2023, at 22:52, Sahan Srinivas <26sa...@gmail.com> wrote:
> 
> Yeah I gave that, actually that is also not the problem. Not sure what it is
> 
> Kind Regards,
> Sahan
> 
> On Sun, Apr 9, 2023 at 3:44 PM Mir Junaid  <mailto:mirjunaid...@gmail.com>> wrote:
> The command is {% load static%}
> 
> On Sun, 9 Apr, 2023, 11:45 pm Sahan Srinivas, <26sa...@gmail.com 
> <mailto:26sa...@gmail.com>> wrote:
> Hi Devs,
> 
> Images are not showing up in Django. Below is the screenshot
> 
> 
> Below are the screenshots of Settings.py file and urls.py files
> 
> settings.py
> 
> 
> urls.py
> 
> home.html: (I have give like this in html file)
> 
> views.py
> 
> Media Images:
> 
> 
> I followed the documentation, stack overflow but, I am still not sure why 
> images are not showing up. Can anyone help me out?
> 
> Kind regards,
> Sahan
> 
> 
> -- 
> You received this message because you are subscribed to the Google Groups 
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to django-users+unsubscr...@googlegroups.com 
> <mailto:django-users+unsubscr...@googlegroups.com>.
> To view this discussion on the web visit 
> https://groups.google.com/d/msgid/django-users/CAO3SeezAm3Lbe8JGxoCrZ2DCd74p8gFsxzUUoLa5166t6Dm9Kg%40mail.gmail.com
>  
> <https://groups.google.com/d/msgid/django-users/CAO3SeezAm3Lbe8JGxoCrZ2DCd74p8gFsxzUUoLa5166t6Dm9Kg%40mail.gmail.com?utm_medium=email_source=footer>.
> 
> -- 
> You received this message because you are subscribed to the Google Groups 
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to django-users+unsubscr...@googlegroups.com 
> <mailto:django-users+unsubscr...@googlegroups.com>.
> To view this discussion on the web visit 
> https://groups.google.com/d/msgid/django-users/CAM%2BpT8z6w2Pjs6Hb_CxrOvoWSNhYe4SoL3RrTpkp7pHEXr2spg%40mail.gmail.com
>  
> <https://groups.google.com/d/msgid/django-users/CAM%2BpT8z6w2Pjs6Hb_CxrOvoWSNhYe4SoL3RrTpkp7pHEXr2spg%40mail.gmail.com?utm_medium=email_source=footer>.
> 
> -- 
> You received this message because you are subscribed to the Google Groups 
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to django-users+unsubscr...@googlegroups.com 
> <mailto:django-users+unsubscr...@googlegroups.com>.
> To view this discussion on the web visit 
> https://groups.google.com/d/msgid/django-users/CAO3SeeyoR-A%3DW7f0fC-NjLZcqyG-m4oMVoqonQ7r_XmAoaEEMg%40mail.gmail.com
>  
> <https://groups.google.com/d/msgid/django-users/CAO3SeeyoR-A%3DW7f0fC-NjLZcqyG-m4oMVoqonQ7r_XmAoaEEMg%40mail.gmail.com?utm_medium=email_source=footer>.

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/FD4AD59E-9002-46D9-97AB-41DB5B9E4E3D%40gmail.com.


Re: What makes the images deletion from the media folder?

2023-03-30 Thread ram.mu...@gmail.com
Hello David,

We are not using a docker container but our server is a dedicated cloud 
instance.

Best regards,
~Ram



On Thursday, March 23, 2023 at 10:34:44 PM UTC-6 David Nugent wrote:

> Are you using Django in a docker container?
>
> If so, any changes to the filesystem are ephemeral and disappear when the 
> container is recycled.
>
>
> Regards,
> David
>
>
> -- Original Message --
> From "Ram" 
> To django...@googlegroups.com
> Date 3/24/2023 2:04:56 PM
> Subject What makes the images deletion from the media folder?
>
> Hi,
>
> We are seeing weird issue that images are deleted between deployments in 
> our Dev. server and we are seeing this message in log files:
>
> example:
>
> WARNING 2023-03-10 07:03:16,927 - Not Found: /media/cl_1zf3am8.JPG
>
>
> Could someone let me know what could be the issue?
>
> Best regards,
> ~Ram 
>
> -- 
> You received this message because you are subscribed to the Google Groups 
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to django-users...@googlegroups.com.
> To view this discussion on the web visit 
> https://groups.google.com/d/msgid/django-users/CA%2BOi5F2mTfx%2B32XKjM__gkgp0i7vPKgWsGuGVGQsr%3DSX_U0MRg%40mail.gmail.com
>  
> <https://groups.google.com/d/msgid/django-users/CA%2BOi5F2mTfx%2B32XKjM__gkgp0i7vPKgWsGuGVGQsr%3DSX_U0MRg%40mail.gmail.com?utm_medium=email_source=footer>
> .
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/2ba08875-fb1a-4f11-a2db-435d9973c7c4n%40googlegroups.com.


Re: What makes the images deletion from the media folder?

2023-03-23 Thread David Nugent

Are you using Django in a docker container?

If so, any changes to the filesystem are ephemeral and disappear when 
the container is recycled.



Regards,
David


-- Original Message --

From "Ram" 

To django-users@googlegroups.com
Date 3/24/2023 2:04:56 PM
Subject What makes the images deletion from the media folder?


Hi,

We are seeing weird issue that images are deleted between deployments 
in our Dev. server and we are seeing this message in log files:


example:


WARNING 2023-03-10 07:03:16,927 - Not Found: /media/cl_1zf3am8.JPG


Could someone let me know what could be the issue?

Best regards,
~Ram

--
You received this message because you are subscribed to the Google 
Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send 
an email to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CA%2BOi5F2mTfx%2B32XKjM__gkgp0i7vPKgWsGuGVGQsr%3DSX_U0MRg%40mail.gmail.com 
<https://groups.google.com/d/msgid/django-users/CA%2BOi5F2mTfx%2B32XKjM__gkgp0i7vPKgWsGuGVGQsr%3DSX_U0MRg%40mail.gmail.com?utm_medium=email_source=footer>.


--
You received this message because you are subscribed to the Google Groups "Django 
users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/em8b3dd4e8-2fe8-4b70-83f5-c101dc8a3700%4090728edb.com.


pgpKPeR2T_cod.pgp
Description: PGP signature


What makes the images deletion from the media folder?

2023-03-23 Thread Ram
Hi,

We are seeing weird issue that images are deleted between deployments in
our Dev. server and we are seeing this message in log files:

example:

WARNING 2023-03-10 07:03:16,927 - Not Found: /media/cl_1zf3am8.JPG


Could someone let me know what could be the issue?

Best regards,
~Ram

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CA%2BOi5F2mTfx%2B32XKjM__gkgp0i7vPKgWsGuGVGQsr%3DSX_U0MRg%40mail.gmail.com.


Re: Trying to render images from database

2023-03-10 Thread Michael Starr
I don't understand what you mean. There are no images. There's no img src 
except in code. I can't just right click on it because it's not there.

And I know the src of the image, because I'm the one who coded it. Also it 
spits it out when I print the coded url. This was all in a previous post in 
this thread.

On Tuesday, March 7, 2023 at 4:09:04 PM UTC-8 Red Plant wrote:

> If not, check each img src using your browser's dev tools.
>
> On Wed, Mar 8, 2023 at 8:07 AM Red Plant  wrote:
>
>> Have you checked each img src?
>>
>> On Wed, Mar 8, 2023 at 6:17 AM Michael Starr  wrote:
>>
>>> I am using FireFox.
>>>
>>> On Tuesday, March 7, 2023 at 2:11:38 PM UTC-8 Michael Starr wrote:
>>>
>>>> this.window.gBrowserInit is undefined ext-browser.js:1134
>>>> get activeTab chrome://browser/content/parent/ext-browser.js:1134
>>>> candidates chrome://extensions/content/parent/ext-tabs-base.js:2091
>>>> next self-hosted:1743
>>>> query chrome://extensions/content/parent/ext-tabs-base.js:2113
>>>> next self-hosted:1743
>>>> from self-hosted:516
>>>> query chrome://browser/content/parent/ext-tabs.js:1000
>>>> query self-hosted:1359
>>>> result resource://gre/modules/ExtensionParent.jsm:1156
>>>> withCallContextData resource://gre/modules/ExtensionParent.jsm:639
>>>> result resource://gre/modules/ExtensionParent.jsm:1155
>>>> withPendingBrowser resource://gre/modules/ExtensionParent.jsm:649
>>>> result resource://gre/modules/ExtensionParent.jsm:1154
>>>> callAndLog resource://gre/modules/ExtensionParent.jsm:1107
>>>> recvAPICall resource://gre/modules/ExtensionParent.jsm:1153
>>>> AsyncFunctionNext self-hosted:810
>>>>
>>>>
>>>> On Tuesday, March 7, 2023 at 1:58:12 PM UTC-8 Red Plant wrote:
>>>>
>>>>> What's showing on the browser console?
>>>>>
>>>>> If you're using chrome, press F12 to open developer tools, then find 
>>>>> the console tab.
>>>>>
>>>>> On Wed, Mar 8, 2023, 1:31 AM Michael Starr  wrote:
>>>>>
>>>>>> Well, my privilege of posting "" on SO was revoked so I can't get my 
>>>>>> questions answered anymore. So I guess I just won't be a developer now. 
>>>>>> Or 
>>>>>> the alternative, reinvent all code and the internet.
>>>>>> The answer the dude gave me wasn't sufficient and he was like, 
>>>>>> "Accept the answer!" Devious prick. And then he was like "share your 
>>>>>> code 
>>>>>> with me!" And what he does is copy your code into his github account and 
>>>>>> claim he "helped" you.
>>>>>> Blah. What a loser.
>>>>>> So anyway, it still shows img alt text BUT now when I upload a photo 
>>>>>> into the pet_photo object, it appends a six digit ASCII text thingy to 
>>>>>> the 
>>>>>> filename, so the filename isn't actually correct even, anymore.
>>>>>> So many problems. Django is NOT the api for perfectionists with 
>>>>>> deadlines.
>>>>>> Mike
>>>>>>
>>>>>> On Saturday, March 4, 2023 at 3:31:30 PM UTC-8 Michael Starr wrote:
>>>>>>
>>>>>>> Thank you Sandip. I missed that.
>>>>>>>
>>>>>>> In any case I have revamped the code with some help from stack 
>>>>>>> overflow here 
>>>>>>> https://stackoverflow.com/questions/75632266/displaying-an-image-stored-in-a-django-database
>>>>>>> However the image alt text instead of the image displays! So weird! 
>>>>>>>
>>>>>>> class PetOwnerDetailView(DetailView):
>>>>>>> model = PetOwner
>>>>>>> context_object_name = "owner"
>>>>>>> template_name = "pet_owner_profile.html"
>>>>>>> def get_context_data(self, *args, **kwargs):
>>>>>>> context = super().get_context_data(**kwargs)
>>>>>>> pets = Pet.objects.all()
>>>>>>> pet_data = {}
>>>>>>> for pet in pets:
>>>>>>> pet_data[pet] = PetPhoto.objects.filter(pets=pet)
>>>>>>> context['pet

Re: Trying to render images from database

2023-03-07 Thread Michael Starr
I am using FireFox.

On Tuesday, March 7, 2023 at 2:11:38 PM UTC-8 Michael Starr wrote:

> this.window.gBrowserInit is undefined ext-browser.js:1134
> get activeTab chrome://browser/content/parent/ext-browser.js:1134
> candidates chrome://extensions/content/parent/ext-tabs-base.js:2091
> next self-hosted:1743
> query chrome://extensions/content/parent/ext-tabs-base.js:2113
> next self-hosted:1743
> from self-hosted:516
> query chrome://browser/content/parent/ext-tabs.js:1000
> query self-hosted:1359
> result resource://gre/modules/ExtensionParent.jsm:1156
> withCallContextData resource://gre/modules/ExtensionParent.jsm:639
> result resource://gre/modules/ExtensionParent.jsm:1155
> withPendingBrowser resource://gre/modules/ExtensionParent.jsm:649
> result resource://gre/modules/ExtensionParent.jsm:1154
> callAndLog resource://gre/modules/ExtensionParent.jsm:1107
> recvAPICall resource://gre/modules/ExtensionParent.jsm:1153
> AsyncFunctionNext self-hosted:810
>
>
> On Tuesday, March 7, 2023 at 1:58:12 PM UTC-8 Red Plant wrote:
>
>> What's showing on the browser console?
>>
>> If you're using chrome, press F12 to open developer tools, then find the 
>> console tab.
>>
>> On Wed, Mar 8, 2023, 1:31 AM Michael Starr  wrote:
>>
>>> Well, my privilege of posting "" on SO was revoked so I can't get my 
>>> questions answered anymore. So I guess I just won't be a developer now. Or 
>>> the alternative, reinvent all code and the internet.
>>> The answer the dude gave me wasn't sufficient and he was like, "Accept 
>>> the answer!" Devious prick. And then he was like "share your code with me!" 
>>> And what he does is copy your code into his github account and claim he 
>>> "helped" you.
>>> Blah. What a loser.
>>> So anyway, it still shows img alt text BUT now when I upload a photo 
>>> into the pet_photo object, it appends a six digit ASCII text thingy to the 
>>> filename, so the filename isn't actually correct even, anymore.
>>> So many problems. Django is NOT the api for perfectionists with 
>>> deadlines.
>>> Mike
>>>
>>> On Saturday, March 4, 2023 at 3:31:30 PM UTC-8 Michael Starr wrote:
>>>
 Thank you Sandip. I missed that.

 In any case I have revamped the code with some help from stack overflow 
 here 
 https://stackoverflow.com/questions/75632266/displaying-an-image-stored-in-a-django-database
 However the image alt text instead of the image displays! So weird! 

 class PetOwnerDetailView(DetailView):
 model = PetOwner
 context_object_name = "owner"
 template_name = "pet_owner_profile.html"
 def get_context_data(self, *args, **kwargs):
 context = super().get_context_data(**kwargs)
 pets = Pet.objects.all()
 pet_data = {}
 for pet in pets:
 pet_data[pet] = PetPhoto.objects.filter(pets=pet)
 context['pet_data'] = pet_data
 return context

 {% extends "base.html" %}
 {% block header %}
 {% endblock %}
 {% block content %}
 {{ owner.name }}
 {{ owner.age }}
 {{ owner.location }}
 {{ owner.profile_photo }}
 {% for pet in owner.pets.all %}
 {{ pet.name }}
 {{ pet.animaltype }}
 {{ pet.age }}
 
 {{ pet.name }} Photos
 {% for pet, photos in pet_data.items %}
 {{ pet.name }}
 {% for photo in photos %}
 
 {% endfor %}
 {% endfor %}
 {% endfor %}
 {% endblock %}

 [image: Screenshot 2023-03-04 153038.png]

 So close yet so far! Argh! lol

 Mike

 On Saturday, March 4, 2023 at 1:37:26 AM UTC-8 Sandip Bhattacharya 
 wrote:

> Are you sure this is the right query? This is looking for pet owners 
> with the name “pets”. 
>
> pets = PetOwner.objects.filter(name = "pets”) 
>
> Perhaps, you mean: 
> pets = PetOwner.pets.all() 
>
> - Sandip 
>
> > On Mar 3, 2023, at 8:08 PM, Michael Starr  
> wrote: 
> > 
> > I think this solution 
> > 
> https://stackoverflow.com/questions/75632266/displaying-an-image-stored-in-a-django-database
>  
> > should work but for some reason python got messed up on my laptop 
> when I went mobile at the coffee shop. The PYTHONPATH got deleted the 
> .venv 
> environment was deleted but still displayed and I'm getting a ton of 
> system 
> bugs trying to run python makemigrations or python migrate. 
> > 
> > Frustrating. I am using the python repair tool in the python 
> installer to repair python. Will let you know if the solution works after 
> I 
> get my environment back up and workin.g 
> > On Friday, March 3, 2023 at 2:01:03 PM UTC-8 Michael Starr wrote: 
> > It's not working. 
> > class 

Re: Trying to render images from database

2023-03-07 Thread Michael Starr
this.window.gBrowserInit is undefined ext-browser.js:1134
get activeTab chrome://browser/content/parent/ext-browser.js:1134
candidates chrome://extensions/content/parent/ext-tabs-base.js:2091
next self-hosted:1743
query chrome://extensions/content/parent/ext-tabs-base.js:2113
next self-hosted:1743
from self-hosted:516
query chrome://browser/content/parent/ext-tabs.js:1000
query self-hosted:1359
result resource://gre/modules/ExtensionParent.jsm:1156
withCallContextData resource://gre/modules/ExtensionParent.jsm:639
result resource://gre/modules/ExtensionParent.jsm:1155
withPendingBrowser resource://gre/modules/ExtensionParent.jsm:649
result resource://gre/modules/ExtensionParent.jsm:1154
callAndLog resource://gre/modules/ExtensionParent.jsm:1107
recvAPICall resource://gre/modules/ExtensionParent.jsm:1153
AsyncFunctionNext self-hosted:810


On Tuesday, March 7, 2023 at 1:58:12 PM UTC-8 Red Plant wrote:

> What's showing on the browser console?
>
> If you're using chrome, press F12 to open developer tools, then find the 
> console tab.
>
> On Wed, Mar 8, 2023, 1:31 AM Michael Starr  wrote:
>
>> Well, my privilege of posting "" on SO was revoked so I can't get my 
>> questions answered anymore. So I guess I just won't be a developer now. Or 
>> the alternative, reinvent all code and the internet.
>> The answer the dude gave me wasn't sufficient and he was like, "Accept 
>> the answer!" Devious prick. And then he was like "share your code with me!" 
>> And what he does is copy your code into his github account and claim he 
>> "helped" you.
>> Blah. What a loser.
>> So anyway, it still shows img alt text BUT now when I upload a photo into 
>> the pet_photo object, it appends a six digit ASCII text thingy to the 
>> filename, so the filename isn't actually correct even, anymore.
>> So many problems. Django is NOT the api for perfectionists with deadlines.
>> Mike
>>
>> On Saturday, March 4, 2023 at 3:31:30 PM UTC-8 Michael Starr wrote:
>>
>>> Thank you Sandip. I missed that.
>>>
>>> In any case I have revamped the code with some help from stack overflow 
>>> here 
>>> https://stackoverflow.com/questions/75632266/displaying-an-image-stored-in-a-django-database
>>> However the image alt text instead of the image displays! So weird! 
>>>
>>> class PetOwnerDetailView(DetailView):
>>> model = PetOwner
>>> context_object_name = "owner"
>>> template_name = "pet_owner_profile.html"
>>> def get_context_data(self, *args, **kwargs):
>>> context = super().get_context_data(**kwargs)
>>> pets = Pet.objects.all()
>>> pet_data = {}
>>> for pet in pets:
>>> pet_data[pet] = PetPhoto.objects.filter(pets=pet)
>>> context['pet_data'] = pet_data
>>> return context
>>>
>>> {% extends "base.html" %}
>>> {% block header %}
>>> {% endblock %}
>>> {% block content %}
>>> {{ owner.name }}
>>> {{ owner.age }}
>>> {{ owner.location }}
>>> {{ owner.profile_photo }}
>>> {% for pet in owner.pets.all %}
>>> {{ pet.name }}
>>> {{ pet.animaltype }}
>>> {{ pet.age }}
>>> 
>>> {{ pet.name }} Photos
>>> {% for pet, photos in pet_data.items %}
>>> {{ pet.name }}
>>> {% for photo in photos %}
>>> >> >
>>> {% endfor %}
>>> {% endfor %}
>>> {% endfor %}
>>> {% endblock %}
>>>
>>> [image: Screenshot 2023-03-04 153038.png]
>>>
>>> So close yet so far! Argh! lol
>>>
>>> Mike
>>>
>>> On Saturday, March 4, 2023 at 1:37:26 AM UTC-8 Sandip Bhattacharya wrote:
>>>
 Are you sure this is the right query? This is looking for pet owners 
 with the name “pets”. 

 pets = PetOwner.objects.filter(name = "pets”) 

 Perhaps, you mean: 
 pets = PetOwner.pets.all() 

 - Sandip 

 > On Mar 3, 2023, at 8:08 PM, Michael Starr  
 wrote: 
 > 
 > I think this solution 
 > 
 https://stackoverflow.com/questions/75632266/displaying-an-image-stored-in-a-django-database
  
 > should work but for some reason python got messed up on my laptop 
 when I went mobile at the coffee shop. The PYTHONPATH got deleted the 
 .venv 
 environment was deleted but still displayed and I'm getting a ton of 
 system 
 bugs trying to run python makemigrations or python migrate. 
 > 
 > Frustrating. I am using the python repair tool in the python 
 installer to repair python. Will let you know if the solution works after 
 I 
 get my environment back up and workin.g 
 > On Friday, March 3, 2023 at 2:01:03 PM UTC-8 Michael Starr wrote: 
 > It's not working. 
 > class PetOwnerDetailView(DetailView): 
 > model = PetOwner 
 > context_object_name = "owner" 
 > template_name = "pet_owner_profile.html" 
 > def get_context_data(self, *args, **kwargs): 
 > context = super().get_context_data(**kwargs) 

Re: Trying to render images from database

2023-03-07 Thread Red Plant
What's showing on the browser console?

If you're using chrome, press F12 to open developer tools, then find the
console tab.

On Wed, Mar 8, 2023, 1:31 AM Michael Starr  wrote:

> Well, my privilege of posting "" on SO was revoked so I can't get my
> questions answered anymore. So I guess I just won't be a developer now. Or
> the alternative, reinvent all code and the internet.
> The answer the dude gave me wasn't sufficient and he was like, "Accept the
> answer!" Devious prick. And then he was like "share your code with me!" And
> what he does is copy your code into his github account and claim he
> "helped" you.
> Blah. What a loser.
> So anyway, it still shows img alt text BUT now when I upload a photo into
> the pet_photo object, it appends a six digit ASCII text thingy to the
> filename, so the filename isn't actually correct even, anymore.
> So many problems. Django is NOT the api for perfectionists with deadlines.
> Mike
>
> On Saturday, March 4, 2023 at 3:31:30 PM UTC-8 Michael Starr wrote:
>
>> Thank you Sandip. I missed that.
>>
>> In any case I have revamped the code with some help from stack overflow
>> here
>> https://stackoverflow.com/questions/75632266/displaying-an-image-stored-in-a-django-database
>> However the image alt text instead of the image displays! So weird!
>>
>> class PetOwnerDetailView(DetailView):
>> model = PetOwner
>> context_object_name = "owner"
>> template_name = "pet_owner_profile.html"
>> def get_context_data(self, *args, **kwargs):
>> context = super().get_context_data(**kwargs)
>> pets = Pet.objects.all()
>> pet_data = {}
>> for pet in pets:
>> pet_data[pet] = PetPhoto.objects.filter(pets=pet)
>> context['pet_data'] = pet_data
>> return context
>>
>> {% extends "base.html" %}
>> {% block header %}
>> {% endblock %}
>> {% block content %}
>> {{ owner.name }}
>> {{ owner.age }}
>> {{ owner.location }}
>> {{ owner.profile_photo }}
>> {% for pet in owner.pets.all %}
>> {{ pet.name }}
>> {{ pet.animaltype }}
>> {{ pet.age }}
>> 
>> {{ pet.name }} Photos
>> {% for pet, photos in pet_data.items %}
>> {{ pet.name }}
>> {% for photo in photos %}
>> 
>> {% endfor %}
>> {% endfor %}
>> {% endfor %}
>> {% endblock %}
>>
>> [image: Screenshot 2023-03-04 153038.png]
>>
>> So close yet so far! Argh! lol
>>
>> Mike
>>
>> On Saturday, March 4, 2023 at 1:37:26 AM UTC-8 Sandip Bhattacharya wrote:
>>
>>> Are you sure this is the right query? This is looking for pet owners
>>> with the name “pets”.
>>>
>>> pets = PetOwner.objects.filter(name = "pets”)
>>>
>>> Perhaps, you mean:
>>> pets = PetOwner.pets.all()
>>>
>>> - Sandip
>>>
>>> > On Mar 3, 2023, at 8:08 PM, Michael Starr  wrote:
>>> >
>>> > I think this solution
>>> >
>>> https://stackoverflow.com/questions/75632266/displaying-an-image-stored-in-a-django-database
>>> > should work but for some reason python got messed up on my laptop when
>>> I went mobile at the coffee shop. The PYTHONPATH got deleted the .venv
>>> environment was deleted but still displayed and I'm getting a ton of system
>>> bugs trying to run python makemigrations or python migrate.
>>> >
>>> > Frustrating. I am using the python repair tool in the python installer
>>> to repair python. Will let you know if the solution works after I get my
>>> environment back up and workin.g
>>> > On Friday, March 3, 2023 at 2:01:03 PM UTC-8 Michael Starr wrote:
>>> > It's not working.
>>> > class PetOwnerDetailView(DetailView):
>>> > model = PetOwner
>>> > context_object_name = "owner"
>>> > template_name = "pet_owner_profile.html"
>>> > def get_context_data(self, *args, **kwargs):
>>> > context = super().get_context_data(**kwargs)
>>> > context['pet_photos'] = {}
>>> > pets = PetOwner.objects.filter(name = "pets")
>>> > for pet in pets:
>>> > context['pet_photos'][pet] = []
>>> > for photo in pet.pet_photos:
>>> > context['pet_photos'][pet] += photo
>>> > # context['pet_photos'] = {pet1: [photo1, photo2, photo3], pet2:
>>> [photo1, photo2]}
>>> > return context
>>> >
>>> > {% extends "base.html" %}
>>> > {% block header %}
>>> > {% endblock %}
>>> > {% block content %}
>>> > {{ owner.name }}
>>> > {{ owner.age }}
>>> > {{ owner.location }}
>>> > {{ owner.profile_photo }}
>>> > {% for pet in owner.pets.all %}
>>> > {{ pet.name }}
>>> > {{ pet.animaltype }}
>>> > {{ pet.age }}
>>> > 
>>> > {% for photo in pet_photos.pet.photos %}
>>> > 
>>> > {% endfor %}
>>> > {% endfor %}
>>> > {% endblock %}
>>> >
>>> >
>>> > Nothing shows up. I've tried a million and a half ways to iterate over
>>> the data structure I've created to store pets as keys and photos in a list
>>> as values in get_context_data for 'pet_photos' but nothing ever displays.
>>> >
>>> > Then there's the question of like, are my directory structure and
>>> settings file correct.
>>> >
>>> > STATIC_URL = 

Re: Trying to render images from database

2023-03-07 Thread Michael Starr
this https://docs.djangoproject.com/en/4.1/topics/files/ seems useful, but 
isn't really for me.
Mike

On Tuesday, March 7, 2023 at 9:31:02 AM UTC-8 Michael Starr wrote:

> Well, my privilege of posting "" on SO was revoked so I can't get my 
> questions answered anymore. So I guess I just won't be a developer now. Or 
> the alternative, reinvent all code and the internet.
> The answer the dude gave me wasn't sufficient and he was like, "Accept the 
> answer!" Devious prick. And then he was like "share your code with me!" And 
> what he does is copy your code into his github account and claim he 
> "helped" you.
> Blah. What a loser.
> So anyway, it still shows img alt text BUT now when I upload a photo into 
> the pet_photo object, it appends a six digit ASCII text thingy to the 
> filename, so the filename isn't actually correct even, anymore.
> So many problems. Django is NOT the api for perfectionists with deadlines.
> Mike
>
> On Saturday, March 4, 2023 at 3:31:30 PM UTC-8 Michael Starr wrote:
>
>> Thank you Sandip. I missed that.
>>
>> In any case I have revamped the code with some help from stack overflow 
>> here 
>> https://stackoverflow.com/questions/75632266/displaying-an-image-stored-in-a-django-database
>> However the image alt text instead of the image displays! So weird! 
>>
>> class PetOwnerDetailView(DetailView):
>> model = PetOwner
>> context_object_name = "owner"
>> template_name = "pet_owner_profile.html"
>> def get_context_data(self, *args, **kwargs):
>> context = super().get_context_data(**kwargs)
>> pets = Pet.objects.all()
>> pet_data = {}
>> for pet in pets:
>> pet_data[pet] = PetPhoto.objects.filter(pets=pet)
>> context['pet_data'] = pet_data
>> return context
>>
>> {% extends "base.html" %}
>> {% block header %}
>> {% endblock %}
>> {% block content %}
>> {{ owner.name }}
>> {{ owner.age }}
>> {{ owner.location }}
>> {{ owner.profile_photo }}
>> {% for pet in owner.pets.all %}
>> {{ pet.name }}
>> {{ pet.animaltype }}
>> {{ pet.age }}
>> 
>> {{ pet.name }} Photos
>> {% for pet, photos in pet_data.items %}
>> {{ pet.name }}
>> {% for photo in photos %}
>> 
>> {% endfor %}
>> {% endfor %}
>> {% endfor %}
>> {% endblock %}
>>
>> [image: Screenshot 2023-03-04 153038.png]
>>
>> So close yet so far! Argh! lol
>>
>> Mike
>>
>> On Saturday, March 4, 2023 at 1:37:26 AM UTC-8 Sandip Bhattacharya wrote:
>>
>>> Are you sure this is the right query? This is looking for pet owners 
>>> with the name “pets”. 
>>>
>>> pets = PetOwner.objects.filter(name = "pets”) 
>>>
>>> Perhaps, you mean: 
>>> pets = PetOwner.pets.all() 
>>>
>>> - Sandip 
>>>
>>> > On Mar 3, 2023, at 8:08 PM, Michael Starr  wrote: 
>>> > 
>>> > I think this solution 
>>> > 
>>> https://stackoverflow.com/questions/75632266/displaying-an-image-stored-in-a-django-database
>>>  
>>> > should work but for some reason python got messed up on my laptop when 
>>> I went mobile at the coffee shop. The PYTHONPATH got deleted the .venv 
>>> environment was deleted but still displayed and I'm getting a ton of system 
>>> bugs trying to run python makemigrations or python migrate. 
>>> > 
>>> > Frustrating. I am using the python repair tool in the python installer 
>>> to repair python. Will let you know if the solution works after I get my 
>>> environment back up and workin.g 
>>> > On Friday, March 3, 2023 at 2:01:03 PM UTC-8 Michael Starr wrote: 
>>> > It's not working. 
>>> > class PetOwnerDetailView(DetailView): 
>>> > model = PetOwner 
>>> > context_object_name = "owner" 
>>> > template_name = "pet_owner_profile.html" 
>>> > def get_context_data(self, *args, **kwargs): 
>>> > context = super().get_context_data(**kwargs) 
>>> > context['pet_photos'] = {} 
>>> > pets = PetOwner.objects.filter(name = "pets") 
>>> > for pet in pets: 
>>> > context['pet_photos'][pet] = [] 
>>> > for photo in pet.pet_photos: 
>>> > context['pet_photos'][pet] += photo 
>>> > # context['pet_photos'] = {pet1: [photo1, photo2, photo3], pet2: 
>>> [photo1, photo2]} 
>>> > return context 
>>> > 
>>> > {% extends "base.html" %} 
>>> > {% block header %} 
>>> > {% endblock %} 
>>> > {% block content %} 
>>> > {{ owner.name }} 
>>> > {{ owner.age }} 
>>> > {{ owner.location }} 
>>> > {{ owner.profile_photo }} 
>>> > {% for pet in owner.pets.all %} 
>>> > {{ pet.name }} 
>>> > {{ pet.animaltype }} 
>>> > {{ pet.age }} 
>>> >  
>>> > {% for photo in pet_photos.pet.photos %} 
>>> >  
>>> > {% endfor %} 
>>> > {% endfor %} 
>>> > {% endblock %} 
>>> > 
>>> > 
>>> > Nothing shows up. I've tried a million and a half ways to iterate over 
>>> the data structure I've created to store pets as keys and photos in a list 
>>> as values in get_context_data for 'pet_photos' but nothing ever displays. 
>>> > 
>>> > Then there's the question of like, are my directory 

Re: Trying to render images from database

2023-03-07 Thread Michael Starr
Well, my privilege of posting "" on SO was revoked so I can't get my 
questions answered anymore. So I guess I just won't be a developer now. Or 
the alternative, reinvent all code and the internet.
The answer the dude gave me wasn't sufficient and he was like, "Accept the 
answer!" Devious prick. And then he was like "share your code with me!" And 
what he does is copy your code into his github account and claim he 
"helped" you.
Blah. What a loser.
So anyway, it still shows img alt text BUT now when I upload a photo into 
the pet_photo object, it appends a six digit ASCII text thingy to the 
filename, so the filename isn't actually correct even, anymore.
So many problems. Django is NOT the api for perfectionists with deadlines.
Mike

On Saturday, March 4, 2023 at 3:31:30 PM UTC-8 Michael Starr wrote:

> Thank you Sandip. I missed that.
>
> In any case I have revamped the code with some help from stack overflow 
> here 
> https://stackoverflow.com/questions/75632266/displaying-an-image-stored-in-a-django-database
> However the image alt text instead of the image displays! So weird! 
>
> class PetOwnerDetailView(DetailView):
> model = PetOwner
> context_object_name = "owner"
> template_name = "pet_owner_profile.html"
> def get_context_data(self, *args, **kwargs):
> context = super().get_context_data(**kwargs)
> pets = Pet.objects.all()
> pet_data = {}
> for pet in pets:
> pet_data[pet] = PetPhoto.objects.filter(pets=pet)
> context['pet_data'] = pet_data
> return context
>
> {% extends "base.html" %}
> {% block header %}
> {% endblock %}
> {% block content %}
> {{ owner.name }}
> {{ owner.age }}
> {{ owner.location }}
> {{ owner.profile_photo }}
> {% for pet in owner.pets.all %}
> {{ pet.name }}
> {{ pet.animaltype }}
> {{ pet.age }}
> 
> {{ pet.name }} Photos
> {% for pet, photos in pet_data.items %}
> {{ pet.name }}
> {% for photo in photos %}
> 
> {% endfor %}
> {% endfor %}
> {% endfor %}
> {% endblock %}
>
> [image: Screenshot 2023-03-04 153038.png]
>
> So close yet so far! Argh! lol
>
> Mike
>
> On Saturday, March 4, 2023 at 1:37:26 AM UTC-8 Sandip Bhattacharya wrote:
>
>> Are you sure this is the right query? This is looking for pet owners with 
>> the name “pets”. 
>>
>> pets = PetOwner.objects.filter(name = "pets”) 
>>
>> Perhaps, you mean: 
>> pets = PetOwner.pets.all() 
>>
>> - Sandip 
>>
>> > On Mar 3, 2023, at 8:08 PM, Michael Starr  wrote: 
>> > 
>> > I think this solution 
>> > 
>> https://stackoverflow.com/questions/75632266/displaying-an-image-stored-in-a-django-database
>>  
>> > should work but for some reason python got messed up on my laptop when 
>> I went mobile at the coffee shop. The PYTHONPATH got deleted the .venv 
>> environment was deleted but still displayed and I'm getting a ton of system 
>> bugs trying to run python makemigrations or python migrate. 
>> > 
>> > Frustrating. I am using the python repair tool in the python installer 
>> to repair python. Will let you know if the solution works after I get my 
>> environment back up and workin.g 
>> > On Friday, March 3, 2023 at 2:01:03 PM UTC-8 Michael Starr wrote: 
>> > It's not working. 
>> > class PetOwnerDetailView(DetailView): 
>> > model = PetOwner 
>> > context_object_name = "owner" 
>> > template_name = "pet_owner_profile.html" 
>> > def get_context_data(self, *args, **kwargs): 
>> > context = super().get_context_data(**kwargs) 
>> > context['pet_photos'] = {} 
>> > pets = PetOwner.objects.filter(name = "pets") 
>> > for pet in pets: 
>> > context['pet_photos'][pet] = [] 
>> > for photo in pet.pet_photos: 
>> > context['pet_photos'][pet] += photo 
>> > # context['pet_photos'] = {pet1: [photo1, photo2, photo3], pet2: 
>> [photo1, photo2]} 
>> > return context 
>> > 
>> > {% extends "base.html" %} 
>> > {% block header %} 
>> > {% endblock %} 
>> > {% block content %} 
>> > {{ owner.name }} 
>> > {{ owner.age }} 
>> > {{ owner.location }} 
>> > {{ owner.profile_photo }} 
>> > {% for pet in owner.pets.all %} 
>> > {{ pet.name }} 
>> > {{ pet.animaltype }} 
>> > {{ pet.age }} 
>> >  
>> > {% for photo in pet_photos.pet.photos %} 
>> >  
>> > {% endfor %} 
>> > {% endfor %} 
>> > {% endblock %} 
>> > 
>> > 
>> > Nothing shows up. I've tried a million and a half ways to iterate over 
>> the data structure I've created to store pets as keys and photos in a list 
>> as values in get_context_data for 'pet_photos' but nothing ever displays. 
>> > 
>> > Then there's the question of like, are my directory structure and 
>> settings file correct. 
>> > 
>> > STATIC_URL = '/static/' 
>> > STATIC_ROOT = os.path.join(BASE_DIR, 'static/') 
>> > 
>> > pet_memorial/static/ is the file path. I don't know if that's right or 
>> it needs to be in the project sub-directory. It's impossible to figure this 
>> out online. No one explains 

Re: Can't render images from database

2023-03-03 Thread Chelsea Fan
did you setup static and media files?

On Sat, Mar 4, 2023 at 3:00 AM Michael Starr  wrote:

> My next issue is that I'm having difficulty displaying images stored in
> the database.
>
> It's a mouthful so I'll spare you, but I'll add details as I go along.
>
> Michael
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/04cb18d8-4609-43a4-9296-96d6b597daban%40googlegroups.com
> <https://groups.google.com/d/msgid/django-users/04cb18d8-4609-43a4-9296-96d6b597daban%40googlegroups.com?utm_medium=email_source=footer>
> .
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAJwZndfr8%3Da5jCJGRLNeKAWeersxt8sBFsWzCc%3DUKUmBxK5%3DdA%40mail.gmail.com.


Trying to render images from database

2023-03-03 Thread Michael Starr
It's not working.
class PetOwnerDetailView(DetailView):
model = PetOwner
context_object_name = "owner"
template_name = "pet_owner_profile.html"
def get_context_data(self, *args, **kwargs):
context = super().get_context_data(**kwargs)
context['pet_photos'] = {}
pets = PetOwner.objects.filter(name = "pets")
for pet in pets:
context['pet_photos'][pet] = []
for photo in pet.pet_photos:
context['pet_photos'][pet] += photo
# context['pet_photos'] = {pet1: [photo1, photo2, photo3], pet2: 
[photo1, photo2]}
return context

{% extends "base.html" %}
{% block header %}
{% endblock %}
{% block content %}
{{ owner.name }}
{{ owner.age }}
{{ owner.location }}
{{ owner.profile_photo }}
{% for pet in owner.pets.all %}
{{ pet.name }}
{{ pet.animaltype }}
{{ pet.age }}

{% for photo in pet_photos.pet.photos %}

{% endfor %}
{% endfor %}
{% endblock %}


Nothing shows up. I've tried a million and a half ways to iterate over the 
data structure I've created to store pets as keys and photos in a list as 
values in get_context_data for 'pet_photos' but nothing ever displays.

Then there's the question of like, are my directory structure and settings 
file correct.

STATIC_URL = '/static/'
STATIC_ROOT = os.path.join(BASE_DIR, 'static/')

pet_memorial/static/ is the file path. I don't know if that's right or it 
needs to be in the project sub-directory. It's impossible to figure this 
out online. No one explains these simple simple things CLEARLY.

So frustrating.

Michael



-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/df428834-55c9-4657-b734-e300d55929fdn%40googlegroups.com.


Can't render images from database

2023-03-03 Thread Michael Starr
My next issue is that I'm having difficulty displaying images stored in the 
database.

It's a mouthful so I'll spare you, but I'll add details as I go along.

Michael

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/04cb18d8-4609-43a4-9296-96d6b597daban%40googlegroups.com.


Re: I am unable to view images in webpage which is given in html

2022-11-03 Thread ritik sahoo
First you check,you may not be include TEMPLATE_TAG in your settings.py file

On Fri, 4 Nov, 2022, 8:02 am Mario Shaya,  wrote:

> employeedetail.empPhoto.url
>
> Le jeudi 3 novembre 2022 à 22:13:41 UTC+3, subtitle indo a écrit :
>
>> Sorry to write again so quickly.
>>
>> On Thu, Nov 3, 2022 at 10:15 AM muwaga micheal 
>> wrote:
>>
>>> Can you share the code?
>>>
>>> On Wednesday, November 2, 2022 at 3:11:37 PM UTC+3 MaheshKumar wrote:
>>>
 I have given the photos in the database but it does not displays in the
 webpage.

 [image: Screenshot (25).png]

>>> --
>>>
>> You received this message because you are subscribed to the Google Groups
>>> "Django users" group.
>>> To unsubscribe from this group and stop receiving emails from it, send
>>> an email to django-users...@googlegroups.com.
>>>
>> To view this discussion on the web visit
>>> https://groups.google.com/d/msgid/django-users/5f21b5c2-9001-4683-a645-eecaab4dff19n%40googlegroups.com
>>> 
>>> .
>>>
>> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/f763285e-c308-42f2-8074-def703c5d49dn%40googlegroups.com
> 
> .
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAJwehCt86wW_OneVXjo0OF1T_WhxDGx29EUONM83oO9gsNC4sw%40mail.gmail.com.


Re: I am unable to view images in webpage which is given in html

2022-11-03 Thread Mario Shaya
employeedetail.empPhoto.url

Le jeudi 3 novembre 2022 à 22:13:41 UTC+3, subtitle indo a écrit :

> Sorry to write again so quickly.
>
> On Thu, Nov 3, 2022 at 10:15 AM muwaga micheal  wrote:
>
>> Can you share the code?
>>
>> On Wednesday, November 2, 2022 at 3:11:37 PM UTC+3 MaheshKumar wrote:
>>
>>> I have given the photos in the database but it does not displays in the 
>>> webpage.
>>>
>>> [image: Screenshot (25).png]
>>>
>> -- 
>>
> You received this message because you are subscribed to the Google Groups 
>> "Django users" group.
>> To unsubscribe from this group and stop receiving emails from it, send an 
>> email to django-users...@googlegroups.com.
>>
> To view this discussion on the web visit 
>> https://groups.google.com/d/msgid/django-users/5f21b5c2-9001-4683-a645-eecaab4dff19n%40googlegroups.com
>>  
>> 
>> .
>>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/f763285e-c308-42f2-8074-def703c5d49dn%40googlegroups.com.


Re: I am unable to view images in webpage which is given in html

2022-11-03 Thread muwaga micheal
Can you share the code?

On Wednesday, November 2, 2022 at 3:11:37 PM UTC+3 MaheshKumar wrote:

> I have given the photos in the database but it does not displays in the 
> webpage.
>
> [image: Screenshot (25).png]
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/5f21b5c2-9001-4683-a645-eecaab4dff19n%40googlegroups.com.


Re: Sending Live Streaming Images from Client’s Webcam to Django Server

2022-10-13 Thread RANGA BHARATH JINKA
Hi,
Please follow this. All the best

https://www.geekfeed.co.jp/geekblog/sending-live-streaming-images-from-clients-webcam-to-django-server/

Thanks and Regards

J. Ranga Bharath
Cell: 9110334114


On Wed, 12 Oct 2022, 9:13 pm Anshuman Thakur, 
wrote:

> Sir my question is: Sending Live Streaming  from Client’s Webcam to
> Django Server.
>
>
> On Tue, Oct 11, 2022 at 2:39 AM 'Kasper Laudrup' via Django users <
> django-users@googlegroups.com> wrote:
>
>> On 08/10/2022 21.28, Anshuman Thakur wrote:
>> > Sr plz anyone help me for this question
>> >
>>
>> Which question?
>>
>> It would be easier for someone to help you if you actually asked a
>> question.
>>
>> Kind regards,
>>
>> Kasper Laudrup
>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "Django users" group.
>> To unsubscribe from this group and stop receiving emails from it, send an
>> email to django-users+unsubscr...@googlegroups.com.
>> To view this discussion on the web visit
>> https://groups.google.com/d/msgid/django-users/fe047fd3-39e1-3eaf-eb41-05ecc54bfc34%40stacktrace.dk
>> .
>>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/CADGZiBqbJYj%3DvQ8D%2BuL3rL8hRQpxYQhr-EBsLA9ySC%3Dp3sm9uw%40mail.gmail.com
> <https://groups.google.com/d/msgid/django-users/CADGZiBqbJYj%3DvQ8D%2BuL3rL8hRQpxYQhr-EBsLA9ySC%3Dp3sm9uw%40mail.gmail.com?utm_medium=email_source=footer>
> .
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAK5m314Dy-6PHYHz1vBRetOSgsTAQdnqy-XsGWxoO8PiEKU1wg%40mail.gmail.com.


Re: Sending Live Streaming Images from Client’s Webcam to Django Server

2022-10-12 Thread Anshuman Thakur
My question is how to send live streaming from client webcam to Django 
server.

On Tuesday, October 11, 2022 at 8:21:48 PM UTC+5:30 amruth...@gmail.com 
wrote:

> This is secret key may be you would share this ? Which key is it
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/8fee0563-bce7-4dc5-bd95-62bf4756317fn%40googlegroups.com.


Re: Sending Live Streaming Images from Client’s Webcam to Django Server

2022-10-12 Thread Anshuman Thakur
Sir my question is: Sending Live Streaming  from Client’s Webcam to Django
Server.


On Tue, Oct 11, 2022 at 2:39 AM 'Kasper Laudrup' via Django users <
django-users@googlegroups.com> wrote:

> On 08/10/2022 21.28, Anshuman Thakur wrote:
> > Sr plz anyone help me for this question
> >
>
> Which question?
>
> It would be easier for someone to help you if you actually asked a
> question.
>
> Kind regards,
>
> Kasper Laudrup
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/fe047fd3-39e1-3eaf-eb41-05ecc54bfc34%40stacktrace.dk
> .
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CADGZiBqbJYj%3DvQ8D%2BuL3rL8hRQpxYQhr-EBsLA9ySC%3Dp3sm9uw%40mail.gmail.com.


Re: Sending Live Streaming Images from Client’s Webcam to Django Server

2022-10-11 Thread amruth bitla
This is secret key may be you would share this ? Which key is it

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CA%2BKLm_jobDvQmVJvT0L4pqe3pUHhOY2U%3DEX8r67K_v6qhAggaA%40mail.gmail.com.


Re: Sending Live Streaming Images from Client’s Webcam to Django Server

2022-10-10 Thread 'Kasper Laudrup' via Django users

On 08/10/2022 21.28, Anshuman Thakur wrote:

Sr plz anyone help me for this question



Which question?

It would be easier for someone to help you if you actually asked a question.

Kind regards,

Kasper Laudrup

--
You received this message because you are subscribed to the Google Groups "Django 
users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/fe047fd3-39e1-3eaf-eb41-05ecc54bfc34%40stacktrace.dk.


OpenPGP_0xE5D9CAC64AAA55EB.asc
Description: OpenPGP public key


OpenPGP_signature
Description: OpenPGP digital signature


Re: Images

2022-05-13 Thread Boris Pérez
If the images files are sotored in static:
{% load static %}



El vie, 13 may 2022 a las 10:03, Nicolas Passarini (<
nicolaspassar...@gmail.com>) escribió:

> how do you refer to the object in the template?
>
> El martes, 10 de mayo de 2022 a la(s) 09:58:56 UTC-3, narsh...@gmail.com
> escribió:
>
>> You change the names of the pictures in the separate folder then copy
>> them in a static folder then change the picture file names in the template
>> folder then refresh then see pictures are new ones or not
>>
>> On Mon, 9 May 2022 at 20:15, Aliya Janmohamed 
>> wrote:
>>
>>> Hi
>>>
>>> It is still displaying the same image as above.
>>>
>>> On Sun, 8 May 2022 at 03:34, Arshad Noman  wrote:
>>>
>>>> First, you change the picture name and place it in the pictures folder
>>>> like static or media folder then change the picture name in templates where
>>>> you want the picture to be displayed
>>>>
>>>>
>>>> <https://www.avast.com/sig-email?utm_medium=email_source=link_campaign=sig-email_content=webmail_term=icon>
>>>>  Virus-free.
>>>> www.avast.com
>>>> <https://www.avast.com/sig-email?utm_medium=email_source=link_campaign=sig-email_content=webmail_term=link>
>>>> <#m_-8114907552984717051_m_3502899349567986621_m_-4392793013509788988_m_-8012441007838514003_DAB4FAD8-2DD7-40BB-A1B8-4E2AA1F9FDF2>
>>>>
>>>> On Sun, 8 May 2022 at 03:37, Aliya Janmohamed 
>>>> wrote:
>>>>
>>>>> Hello,
>>>>>
>>>>> I cannot load my images, this is what shows:
>>>>>
>>>>>
>>>>> --
>>>>> You received this message because you are subscribed to the Google
>>>>> Groups "Django users" group.
>>>>> To unsubscribe from this group and stop receiving emails from it, send
>>>>> an email to django-users...@googlegroups.com.
>>>>> To view this discussion on the web visit
>>>>> https://groups.google.com/d/msgid/django-users/2dc9f275-adcf-4a03-b8ed-db4aad8dfbc6n%40googlegroups.com
>>>>> <https://groups.google.com/d/msgid/django-users/2dc9f275-adcf-4a03-b8ed-db4aad8dfbc6n%40googlegroups.com?utm_medium=email_source=footer>
>>>>> .
>>>>>
>>>> --
>>>> You received this message because you are subscribed to a topic in the
>>>> Google Groups "Django users" group.
>>>> To unsubscribe from this topic, visit
>>>> https://groups.google.com/d/topic/django-users/M5ZOBHwScMA/unsubscribe.
>>>> To unsubscribe from this group and all its topics, send an email to
>>>> django-users...@googlegroups.com.
>>>> To view this discussion on the web visit
>>>> https://groups.google.com/d/msgid/django-users/CA%2B0oV2hu4SW1VJc0H%3DEfCnBsXLts0K8y_T_C-jjdpE5754r90g%40mail.gmail.com
>>>> <https://groups.google.com/d/msgid/django-users/CA%2B0oV2hu4SW1VJc0H%3DEfCnBsXLts0K8y_T_C-jjdpE5754r90g%40mail.gmail.com?utm_medium=email_source=footer>
>>>> .
>>>>
>>> --
>>> You received this message because you are subscribed to the Google
>>> Groups "Django users" group.
>>> To unsubscribe from this group and stop receiving emails from it, send
>>> an email to django-users...@googlegroups.com.
>>>
>> To view this discussion on the web visit
>>> https://groups.google.com/d/msgid/django-users/CALHQhB7p5fnh2PQRKZYx9rCt3ZgHyGazV41Px4gyqBZv%3DQZJJA%40mail.gmail.com
>>> <https://groups.google.com/d/msgid/django-users/CALHQhB7p5fnh2PQRKZYx9rCt3ZgHyGazV41Px4gyqBZv%3DQZJJA%40mail.gmail.com?utm_medium=email_source=footer>
>>> .
>>>
>> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/b93e1ab4-bd95-4df3-b1b3-7970261baa12n%40googlegroups.com
> <https://groups.google.com/d/msgid/django-users/b93e1ab4-bd95-4df3-b1b3-7970261baa12n%40googlegroups.com?utm_medium=email_source=footer>
> .
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAObPVPD8-T_QjCqwZ47bT%2BYT%2BHX%3Dpdwd%3DOEEUQYfiCWQJtxgWg%40mail.gmail.com.


Re: Images

2022-05-13 Thread Nicolas Passarini
how do you refer to the object in the template?

El martes, 10 de mayo de 2022 a la(s) 09:58:56 UTC-3, narsh...@gmail.com 
escribió:

> You change the names of the pictures in the separate folder then copy them 
> in a static folder then change the picture file names in the template 
> folder then refresh then see pictures are new ones or not
>
> On Mon, 9 May 2022 at 20:15, Aliya Janmohamed  
> wrote:
>
>> Hi 
>>
>> It is still displaying the same image as above. 
>>
>> On Sun, 8 May 2022 at 03:34, Arshad Noman  wrote:
>>
>>> First, you change the picture name and place it in the pictures folder 
>>> like static or media folder then change the picture name in templates where 
>>> you want the picture to be displayed
>>>
>>>
>>> <https://www.avast.com/sig-email?utm_medium=email_source=link_campaign=sig-email_content=webmail_term=icon>
>>>  Virus-free. 
>>> www.avast.com 
>>> <https://www.avast.com/sig-email?utm_medium=email_source=link_campaign=sig-email_content=webmail_term=link>
>>>  
>>> <#m_3502899349567986621_m_-4392793013509788988_m_-8012441007838514003_DAB4FAD8-2DD7-40BB-A1B8-4E2AA1F9FDF2>
>>>
>>> On Sun, 8 May 2022 at 03:37, Aliya Janmohamed  
>>> wrote:
>>>
>>>> Hello, 
>>>>
>>>> I cannot load my images, this is what shows:
>>>>
>>>>
>>>> -- 
>>>> You received this message because you are subscribed to the Google 
>>>> Groups "Django users" group.
>>>> To unsubscribe from this group and stop receiving emails from it, send 
>>>> an email to django-users...@googlegroups.com.
>>>> To view this discussion on the web visit 
>>>> https://groups.google.com/d/msgid/django-users/2dc9f275-adcf-4a03-b8ed-db4aad8dfbc6n%40googlegroups.com
>>>>  
>>>> <https://groups.google.com/d/msgid/django-users/2dc9f275-adcf-4a03-b8ed-db4aad8dfbc6n%40googlegroups.com?utm_medium=email_source=footer>
>>>> .
>>>>
>>> -- 
>>> You received this message because you are subscribed to a topic in the 
>>> Google Groups "Django users" group.
>>> To unsubscribe from this topic, visit 
>>> https://groups.google.com/d/topic/django-users/M5ZOBHwScMA/unsubscribe.
>>> To unsubscribe from this group and all its topics, send an email to 
>>> django-users...@googlegroups.com.
>>> To view this discussion on the web visit 
>>> https://groups.google.com/d/msgid/django-users/CA%2B0oV2hu4SW1VJc0H%3DEfCnBsXLts0K8y_T_C-jjdpE5754r90g%40mail.gmail.com
>>>  
>>> <https://groups.google.com/d/msgid/django-users/CA%2B0oV2hu4SW1VJc0H%3DEfCnBsXLts0K8y_T_C-jjdpE5754r90g%40mail.gmail.com?utm_medium=email_source=footer>
>>> .
>>>
>> -- 
>> You received this message because you are subscribed to the Google Groups 
>> "Django users" group.
>> To unsubscribe from this group and stop receiving emails from it, send an 
>> email to django-users...@googlegroups.com.
>>
> To view this discussion on the web visit 
>> https://groups.google.com/d/msgid/django-users/CALHQhB7p5fnh2PQRKZYx9rCt3ZgHyGazV41Px4gyqBZv%3DQZJJA%40mail.gmail.com
>>  
>> <https://groups.google.com/d/msgid/django-users/CALHQhB7p5fnh2PQRKZYx9rCt3ZgHyGazV41Px4gyqBZv%3DQZJJA%40mail.gmail.com?utm_medium=email_source=footer>
>> .
>>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/b93e1ab4-bd95-4df3-b1b3-7970261baa12n%40googlegroups.com.


Re: Images

2022-05-10 Thread Arshad Noman
You change the names of the pictures in the separate folder then copy them
in a static folder then change the picture file names in the template
folder then refresh then see pictures are new ones or not

On Mon, 9 May 2022 at 20:15, Aliya Janmohamed 
wrote:

> Hi
>
> It is still displaying the same image as above.
>
> On Sun, 8 May 2022 at 03:34, Arshad Noman  wrote:
>
>> First, you change the picture name and place it in the pictures folder
>> like static or media folder then change the picture name in templates where
>> you want the picture to be displayed
>>
>>
>> <https://www.avast.com/sig-email?utm_medium=email_source=link_campaign=sig-email_content=webmail_term=icon>
>>  Virus-free.
>> www.avast.com
>> <https://www.avast.com/sig-email?utm_medium=email_source=link_campaign=sig-email_content=webmail_term=link>
>> <#m_-4392793013509788988_m_-8012441007838514003_DAB4FAD8-2DD7-40BB-A1B8-4E2AA1F9FDF2>
>>
>> On Sun, 8 May 2022 at 03:37, Aliya Janmohamed <
>> aliya.janmohame...@gmail.com> wrote:
>>
>>> Hello,
>>>
>>> I cannot load my images, this is what shows:
>>>
>>>
>>> --
>>> You received this message because you are subscribed to the Google
>>> Groups "Django users" group.
>>> To unsubscribe from this group and stop receiving emails from it, send
>>> an email to django-users+unsubscr...@googlegroups.com.
>>> To view this discussion on the web visit
>>> https://groups.google.com/d/msgid/django-users/2dc9f275-adcf-4a03-b8ed-db4aad8dfbc6n%40googlegroups.com
>>> <https://groups.google.com/d/msgid/django-users/2dc9f275-adcf-4a03-b8ed-db4aad8dfbc6n%40googlegroups.com?utm_medium=email_source=footer>
>>> .
>>>
>> --
>> You received this message because you are subscribed to a topic in the
>> Google Groups "Django users" group.
>> To unsubscribe from this topic, visit
>> https://groups.google.com/d/topic/django-users/M5ZOBHwScMA/unsubscribe.
>> To unsubscribe from this group and all its topics, send an email to
>> django-users+unsubscr...@googlegroups.com.
>> To view this discussion on the web visit
>> https://groups.google.com/d/msgid/django-users/CA%2B0oV2hu4SW1VJc0H%3DEfCnBsXLts0K8y_T_C-jjdpE5754r90g%40mail.gmail.com
>> <https://groups.google.com/d/msgid/django-users/CA%2B0oV2hu4SW1VJc0H%3DEfCnBsXLts0K8y_T_C-jjdpE5754r90g%40mail.gmail.com?utm_medium=email_source=footer>
>> .
>>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/CALHQhB7p5fnh2PQRKZYx9rCt3ZgHyGazV41Px4gyqBZv%3DQZJJA%40mail.gmail.com
> <https://groups.google.com/d/msgid/django-users/CALHQhB7p5fnh2PQRKZYx9rCt3ZgHyGazV41Px4gyqBZv%3DQZJJA%40mail.gmail.com?utm_medium=email_source=footer>
> .
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CA%2B0oV2iubvRi-GAdH5gx38hnTJzW41xt2CiMFXgieqQFUPATZQ%40mail.gmail.com.


Re: Images

2022-05-09 Thread Aliya Janmohamed
Hi

It is still displaying the same image as above.

On Sun, 8 May 2022 at 03:34, Arshad Noman  wrote:

> First, you change the picture name and place it in the pictures folder
> like static or media folder then change the picture name in templates where
> you want the picture to be displayed
>
>
> <https://www.avast.com/sig-email?utm_medium=email_source=link_campaign=sig-email_content=webmail_term=icon>
>  Virus-free.
> www.avast.com
> <https://www.avast.com/sig-email?utm_medium=email_source=link_campaign=sig-email_content=webmail_term=link>
> <#m_-8012441007838514003_DAB4FAD8-2DD7-40BB-A1B8-4E2AA1F9FDF2>
>
> On Sun, 8 May 2022 at 03:37, Aliya Janmohamed <
> aliya.janmohame...@gmail.com> wrote:
>
>> Hello,
>>
>> I cannot load my images, this is what shows:
>>
>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "Django users" group.
>> To unsubscribe from this group and stop receiving emails from it, send an
>> email to django-users+unsubscr...@googlegroups.com.
>> To view this discussion on the web visit
>> https://groups.google.com/d/msgid/django-users/2dc9f275-adcf-4a03-b8ed-db4aad8dfbc6n%40googlegroups.com
>> <https://groups.google.com/d/msgid/django-users/2dc9f275-adcf-4a03-b8ed-db4aad8dfbc6n%40googlegroups.com?utm_medium=email_source=footer>
>> .
>>
> --
> You received this message because you are subscribed to a topic in the
> Google Groups "Django users" group.
> To unsubscribe from this topic, visit
> https://groups.google.com/d/topic/django-users/M5ZOBHwScMA/unsubscribe.
> To unsubscribe from this group and all its topics, send an email to
> django-users+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/CA%2B0oV2hu4SW1VJc0H%3DEfCnBsXLts0K8y_T_C-jjdpE5754r90g%40mail.gmail.com
> <https://groups.google.com/d/msgid/django-users/CA%2B0oV2hu4SW1VJc0H%3DEfCnBsXLts0K8y_T_C-jjdpE5754r90g%40mail.gmail.com?utm_medium=email_source=footer>
> .
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CALHQhB7p5fnh2PQRKZYx9rCt3ZgHyGazV41Px4gyqBZv%3DQZJJA%40mail.gmail.com.


Re: Images

2022-05-08 Thread Arshad Noman
First, you change the picture name and place it in the pictures folder like
static or media folder then change the picture name in templates where you
want the picture to be displayed

<https://www.avast.com/sig-email?utm_medium=email_source=link_campaign=sig-email_content=webmail_term=icon>
Virus-free.
www.avast.com
<https://www.avast.com/sig-email?utm_medium=email_source=link_campaign=sig-email_content=webmail_term=link>
<#DAB4FAD8-2DD7-40BB-A1B8-4E2AA1F9FDF2>

On Sun, 8 May 2022 at 03:37, Aliya Janmohamed 
wrote:

> Hello,
>
> I cannot load my images, this is what shows:
>
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/2dc9f275-adcf-4a03-b8ed-db4aad8dfbc6n%40googlegroups.com
> <https://groups.google.com/d/msgid/django-users/2dc9f275-adcf-4a03-b8ed-db4aad8dfbc6n%40googlegroups.com?utm_medium=email_source=footer>
> .
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CA%2B0oV2hu4SW1VJc0H%3DEfCnBsXLts0K8y_T_C-jjdpE5754r90g%40mail.gmail.com.


Images

2022-05-07 Thread Aliya Janmohamed
Hello, 

I cannot load my images, this is what shows:


-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/2dc9f275-adcf-4a03-b8ed-db4aad8dfbc6n%40googlegroups.com.


Re: how to Display images other than from static folder.

2022-02-01 Thread RANGA BHARATH JINKA
Hi,

Please follow this.
https://djangocentral.com/managing-media-files-in-django/
You have to store your images in a static media folder by adding the media
path in settings.py.
This is the recommended way and easy to access the images

All the best

On Wed, Feb 2, 2022 at 11:30 AM RANGA BHARATH JINKA <
bharathjink...@gmail.com> wrote:

> Hi,
>
> Pass the pdf URL as a context variable in the views function. Then you can
> easily access it in your HTML using jinja templating and HTML anchor tag  href="{{pdf_url}}"  download target="__blank" />
>
> All the best
>
> On Wed, Feb 2, 2022 at 11:03 AM ramsha azhar 
> wrote:
>
>> still, I'm confused, Guide me what to write in views.py to display images
>> on my HTML page.
>> the main problem is how to set this path in views.py file to get image
>> from this path. I jst want to display this tree.pdf file on my html page.
>> Any one tell me what to write in views.py?
>> BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
>> filename = 'Tree.pdf'
>> filepath = BASE_DIR + '//' + filename
>> path = open(filepath, 'rb')
>>
>> On Mon, Jan 31, 2022 at 9:00 PM ramsha azhar 
>> wrote:
>>
>>> yes, I set check the attached settings.py file
>>>  just want to know In template page how I set the path od
>>> back directory folder where tree.png is placed.
>>>
>>> On Mon, Jan 31, 2022 at 8:55 PM DJANGO DEVELOPER <
>>> abubakarbr...@gmail.com> wrote:
>>>
>>>> have you set up the static files in settings.py ?
>>>>
>>>> On Mon, Jan 31, 2022 at 8:49 PM ramsha azhar 
>>>> wrote:
>>>>
>>>>> I just want to display the attached Tree.png image on the HTML page
>>>>> but this image is created each time new according to the user input file.
>>>>> guide me how to set the path of this mage on an HTML page or how to 
>>>>> display
>>>>> this tree.png as a user output image.
>>>>>
>>>>> On Mon, Jan 31, 2022 at 8:36 PM DJANGO DEVELOPER <
>>>>> abubakarbr...@gmail.com> wrote:
>>>>>
>>>>>> tell me what you want to get as a result? do you want to display
>>>>>> multiple images on HTML template?
>>>>>>
>>>>>> On Mon, Jan 31, 2022 at 8:27 PM ramsha azhar 
>>>>>> wrote:
>>>>>>
>>>>>>> So guide me the write way ...
>>>>>>>
>>>>>>> On Mon, 31 Jan 2022, 7:45 pm DJANGO DEVELOPER, <
>>>>>>> abubakarbr...@gmail.com> wrote:
>>>>>>>
>>>>>>>> you are doing it the wrong way. totally the wrong way. I am not
>>>>>>>> being rude.
>>>>>>>>
>>>>>>>> On Mon, Jan 31, 2022 at 7:42 PM ramsha azhar <
>>>>>>>> ramshaazha...@gmail.com> wrote:
>>>>>>>>
>>>>>>>>> Gide me Django develpers. I just want to display my pictures that
>>>>>>>>> are created each time new.
>>>>>>>>> My mages are created in my project folder, not in the static
>>>>>>>>> folder.
>>>>>>>>> how I display images on the HTML page by using the path of my
>>>>>>>>> project folder.
>>>>>>>>>
>>>>>>>>> views.py
>>>>>>>>>
>>>>>>>>> def Image_display(request):
>>>>>>>>>   BASE_DIR =
>>>>>>>>> os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
>>>>>>>>>   filename = 'Tree.jpg'
>>>>>>>>>   filepath = BASE_DIR + '//' + filename
>>>>>>>>>   images = Image.objects.all('filepath')
>>>>>>>>>   return render(request, "xyz.html", {'images': images})
>>>>>>>>>
>>>>>>>>> url.py
>>>>>>>>> path('Image_display/', views.Image_display, name="Image_display"),
>>>>>>>>>
>>>>>>>>> HTML page
>>>>>>>>> 
>>>>>>>>> 
>>>>>>>>> 
>>>>>>>>> 
>>>>>>>>>
>>>>>>>>> --
>>>>>>>>> You received this message because you ar

Re: how to Display images other than from static folder.

2022-02-01 Thread RANGA BHARATH JINKA
Hi,

Pass the pdf URL as a context variable in the views function. Then you can
easily access it in your HTML using jinja templating and HTML anchor tag 

All the best

On Wed, Feb 2, 2022 at 11:03 AM ramsha azhar 
wrote:

> still, I'm confused, Guide me what to write in views.py to display images
> on my HTML page.
> the main problem is how to set this path in views.py file to get image
> from this path. I jst want to display this tree.pdf file on my html page.
> Any one tell me what to write in views.py?
> BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
> filename = 'Tree.pdf'
> filepath = BASE_DIR + '//' + filename
> path = open(filepath, 'rb')
>
> On Mon, Jan 31, 2022 at 9:00 PM ramsha azhar 
> wrote:
>
>> yes, I set check the attached settings.py file
>>  just want to know In template page how I set the path od
>> back directory folder where tree.png is placed.
>>
>> On Mon, Jan 31, 2022 at 8:55 PM DJANGO DEVELOPER 
>> wrote:
>>
>>> have you set up the static files in settings.py ?
>>>
>>> On Mon, Jan 31, 2022 at 8:49 PM ramsha azhar 
>>> wrote:
>>>
>>>> I just want to display the attached Tree.png image on the HTML page but
>>>> this image is created each time new according to the user input file. guide
>>>> me how to set the path of this mage on an HTML page or how to display this
>>>> tree.png as a user output image.
>>>>
>>>> On Mon, Jan 31, 2022 at 8:36 PM DJANGO DEVELOPER <
>>>> abubakarbr...@gmail.com> wrote:
>>>>
>>>>> tell me what you want to get as a result? do you want to display
>>>>> multiple images on HTML template?
>>>>>
>>>>> On Mon, Jan 31, 2022 at 8:27 PM ramsha azhar 
>>>>> wrote:
>>>>>
>>>>>> So guide me the write way ...
>>>>>>
>>>>>> On Mon, 31 Jan 2022, 7:45 pm DJANGO DEVELOPER, <
>>>>>> abubakarbr...@gmail.com> wrote:
>>>>>>
>>>>>>> you are doing it the wrong way. totally the wrong way. I am not
>>>>>>> being rude.
>>>>>>>
>>>>>>> On Mon, Jan 31, 2022 at 7:42 PM ramsha azhar <
>>>>>>> ramshaazha...@gmail.com> wrote:
>>>>>>>
>>>>>>>> Gide me Django develpers. I just want to display my pictures that
>>>>>>>> are created each time new.
>>>>>>>> My mages are created in my project folder, not in the static folder.
>>>>>>>> how I display images on the HTML page by using the path of my
>>>>>>>> project folder.
>>>>>>>>
>>>>>>>> views.py
>>>>>>>>
>>>>>>>> def Image_display(request):
>>>>>>>>   BASE_DIR =
>>>>>>>> os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
>>>>>>>>   filename = 'Tree.jpg'
>>>>>>>>   filepath = BASE_DIR + '//' + filename
>>>>>>>>   images = Image.objects.all('filepath')
>>>>>>>>   return render(request, "xyz.html", {'images': images})
>>>>>>>>
>>>>>>>> url.py
>>>>>>>> path('Image_display/', views.Image_display, name="Image_display"),
>>>>>>>>
>>>>>>>> HTML page
>>>>>>>> 
>>>>>>>> 
>>>>>>>> 
>>>>>>>> 
>>>>>>>>
>>>>>>>> --
>>>>>>>> You received this message because you are subscribed to the Google
>>>>>>>> Groups "Django users" group.
>>>>>>>> To unsubscribe from this group and stop receiving emails from it,
>>>>>>>> send an email to django-users+unsubscr...@googlegroups.com.
>>>>>>>> To view this discussion on the web visit
>>>>>>>> https://groups.google.com/d/msgid/django-users/8da245ea-ea90-4730-83c0-accafc93b86bn%40googlegroups.com
>>>>>>>> <https://groups.google.com/d/msgid/django-users/8da245ea-ea90-4730-83c0-accafc93b86bn%40googlegroups.com?utm_medium=email_source=footer>
>>>>>>>> .
>>>>>>>>
>>>>>>> --
>>>>>>> You received this message because you are subscribed to the Google

Re: how to Display images other than from static folder.

2022-02-01 Thread ramsha azhar
still, I'm confused, Guide me what to write in views.py to display images
on my HTML page.
the main problem is how to set this path in views.py file to get image from
this path. I jst want to display this tree.pdf file on my html page.
Any one tell me what to write in views.py?
BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
filename = 'Tree.pdf'
filepath = BASE_DIR + '//' + filename
path = open(filepath, 'rb')

On Mon, Jan 31, 2022 at 9:00 PM ramsha azhar 
wrote:

> yes, I set check the attached settings.py file
>  just want to know In template page how I set the path od
> back directory folder where tree.png is placed.
>
> On Mon, Jan 31, 2022 at 8:55 PM DJANGO DEVELOPER 
> wrote:
>
>> have you set up the static files in settings.py ?
>>
>> On Mon, Jan 31, 2022 at 8:49 PM ramsha azhar 
>> wrote:
>>
>>> I just want to display the attached Tree.png image on the HTML page but
>>> this image is created each time new according to the user input file. guide
>>> me how to set the path of this mage on an HTML page or how to display this
>>> tree.png as a user output image.
>>>
>>> On Mon, Jan 31, 2022 at 8:36 PM DJANGO DEVELOPER <
>>> abubakarbr...@gmail.com> wrote:
>>>
>>>> tell me what you want to get as a result? do you want to display
>>>> multiple images on HTML template?
>>>>
>>>> On Mon, Jan 31, 2022 at 8:27 PM ramsha azhar 
>>>> wrote:
>>>>
>>>>> So guide me the write way ...
>>>>>
>>>>> On Mon, 31 Jan 2022, 7:45 pm DJANGO DEVELOPER, <
>>>>> abubakarbr...@gmail.com> wrote:
>>>>>
>>>>>> you are doing it the wrong way. totally the wrong way. I am not being
>>>>>> rude.
>>>>>>
>>>>>> On Mon, Jan 31, 2022 at 7:42 PM ramsha azhar 
>>>>>> wrote:
>>>>>>
>>>>>>> Gide me Django develpers. I just want to display my pictures that
>>>>>>> are created each time new.
>>>>>>> My mages are created in my project folder, not in the static folder.
>>>>>>> how I display images on the HTML page by using the path of my
>>>>>>> project folder.
>>>>>>>
>>>>>>> views.py
>>>>>>>
>>>>>>> def Image_display(request):
>>>>>>>   BASE_DIR =
>>>>>>> os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
>>>>>>>   filename = 'Tree.jpg'
>>>>>>>   filepath = BASE_DIR + '//' + filename
>>>>>>>   images = Image.objects.all('filepath')
>>>>>>>   return render(request, "xyz.html", {'images': images})
>>>>>>>
>>>>>>> url.py
>>>>>>> path('Image_display/', views.Image_display, name="Image_display"),
>>>>>>>
>>>>>>> HTML page
>>>>>>> 
>>>>>>> 
>>>>>>> 
>>>>>>> 
>>>>>>>
>>>>>>> --
>>>>>>> You received this message because you are subscribed to the Google
>>>>>>> Groups "Django users" group.
>>>>>>> To unsubscribe from this group and stop receiving emails from it,
>>>>>>> send an email to django-users+unsubscr...@googlegroups.com.
>>>>>>> To view this discussion on the web visit
>>>>>>> https://groups.google.com/d/msgid/django-users/8da245ea-ea90-4730-83c0-accafc93b86bn%40googlegroups.com
>>>>>>> <https://groups.google.com/d/msgid/django-users/8da245ea-ea90-4730-83c0-accafc93b86bn%40googlegroups.com?utm_medium=email_source=footer>
>>>>>>> .
>>>>>>>
>>>>>> --
>>>>>> You received this message because you are subscribed to the Google
>>>>>> Groups "Django users" group.
>>>>>> To unsubscribe from this group and stop receiving emails from it,
>>>>>> send an email to django-users+unsubscr...@googlegroups.com.
>>>>>> To view this discussion on the web visit
>>>>>> https://groups.google.com/d/msgid/django-users/CAKPY9p%3DE1FmUc%3Dqqy1tGYBJbimFX873XXSTDndnn4kVUjo3ZWg%40mail.gmail.com
>>>>>> <https://groups.google.com/d/msgid/django-users/CAKPY9p%3DE1FmUc%3Dqqy1tGYBJbimFX873XXSTDndnn4kVUjo3ZWg%40mail.gmail.com?utm_medium=

Re: how to Display images other than from static folder.

2022-01-31 Thread ramsha azhar
yes, I set check the attached settings.py file
 just want to know In template page how I set the path od
back directory folder where tree.png is placed.

On Mon, Jan 31, 2022 at 8:55 PM DJANGO DEVELOPER 
wrote:

> have you set up the static files in settings.py ?
>
> On Mon, Jan 31, 2022 at 8:49 PM ramsha azhar 
> wrote:
>
>> I just want to display the attached Tree.png image on the HTML page but
>> this image is created each time new according to the user input file. guide
>> me how to set the path of this mage on an HTML page or how to display this
>> tree.png as a user output image.
>>
>> On Mon, Jan 31, 2022 at 8:36 PM DJANGO DEVELOPER 
>> wrote:
>>
>>> tell me what you want to get as a result? do you want to display
>>> multiple images on HTML template?
>>>
>>> On Mon, Jan 31, 2022 at 8:27 PM ramsha azhar 
>>> wrote:
>>>
>>>> So guide me the write way ...
>>>>
>>>> On Mon, 31 Jan 2022, 7:45 pm DJANGO DEVELOPER, 
>>>> wrote:
>>>>
>>>>> you are doing it the wrong way. totally the wrong way. I am not being
>>>>> rude.
>>>>>
>>>>> On Mon, Jan 31, 2022 at 7:42 PM ramsha azhar 
>>>>> wrote:
>>>>>
>>>>>> Gide me Django develpers. I just want to display my pictures that are
>>>>>> created each time new.
>>>>>> My mages are created in my project folder, not in the static folder.
>>>>>> how I display images on the HTML page by using the path of my project
>>>>>> folder.
>>>>>>
>>>>>> views.py
>>>>>>
>>>>>> def Image_display(request):
>>>>>>   BASE_DIR =
>>>>>> os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
>>>>>>   filename = 'Tree.jpg'
>>>>>>   filepath = BASE_DIR + '//' + filename
>>>>>>   images = Image.objects.all('filepath')
>>>>>>   return render(request, "xyz.html", {'images': images})
>>>>>>
>>>>>> url.py
>>>>>> path('Image_display/', views.Image_display, name="Image_display"),
>>>>>>
>>>>>> HTML page
>>>>>> 
>>>>>> 
>>>>>> 
>>>>>> 
>>>>>>
>>>>>> --
>>>>>> You received this message because you are subscribed to the Google
>>>>>> Groups "Django users" group.
>>>>>> To unsubscribe from this group and stop receiving emails from it,
>>>>>> send an email to django-users+unsubscr...@googlegroups.com.
>>>>>> To view this discussion on the web visit
>>>>>> https://groups.google.com/d/msgid/django-users/8da245ea-ea90-4730-83c0-accafc93b86bn%40googlegroups.com
>>>>>> <https://groups.google.com/d/msgid/django-users/8da245ea-ea90-4730-83c0-accafc93b86bn%40googlegroups.com?utm_medium=email_source=footer>
>>>>>> .
>>>>>>
>>>>> --
>>>>> You received this message because you are subscribed to the Google
>>>>> Groups "Django users" group.
>>>>> To unsubscribe from this group and stop receiving emails from it, send
>>>>> an email to django-users+unsubscr...@googlegroups.com.
>>>>> To view this discussion on the web visit
>>>>> https://groups.google.com/d/msgid/django-users/CAKPY9p%3DE1FmUc%3Dqqy1tGYBJbimFX873XXSTDndnn4kVUjo3ZWg%40mail.gmail.com
>>>>> <https://groups.google.com/d/msgid/django-users/CAKPY9p%3DE1FmUc%3Dqqy1tGYBJbimFX873XXSTDndnn4kVUjo3ZWg%40mail.gmail.com?utm_medium=email_source=footer>
>>>>> .
>>>>>
>>>> --
>>>> You received this message because you are subscribed to the Google
>>>> Groups "Django users" group.
>>>> To unsubscribe from this group and stop receiving emails from it, send
>>>> an email to django-users+unsubscr...@googlegroups.com.
>>>> To view this discussion on the web visit
>>>> https://groups.google.com/d/msgid/django-users/CAMyb2%3DheLgJo5dMxsCgQ8cm%3Dp0px5EHpLr2frYtDowV8mmC%2BbQ%40mail.gmail.com
>>>> <https://groups.google.com/d/msgid/django-users/CAMyb2%3DheLgJo5dMxsCgQ8cm%3Dp0px5EHpLr2frYtDowV8mmC%2BbQ%40mail.gmail.com?utm_medium=email_source=footer>
>>>> .
>>>>
>>> --
>>> You received this message because you are subscribed to

Re: how to Display images other than from static folder.

2022-01-31 Thread DJANGO DEVELOPER
have you set up the static files in settings.py ?

On Mon, Jan 31, 2022 at 8:49 PM ramsha azhar 
wrote:

> I just want to display the attached Tree.png image on the HTML page but
> this image is created each time new according to the user input file. guide
> me how to set the path of this mage on an HTML page or how to display this
> tree.png as a user output image.
>
> On Mon, Jan 31, 2022 at 8:36 PM DJANGO DEVELOPER 
> wrote:
>
>> tell me what you want to get as a result? do you want to display multiple
>> images on HTML template?
>>
>> On Mon, Jan 31, 2022 at 8:27 PM ramsha azhar 
>> wrote:
>>
>>> So guide me the write way ...
>>>
>>> On Mon, 31 Jan 2022, 7:45 pm DJANGO DEVELOPER, 
>>> wrote:
>>>
>>>> you are doing it the wrong way. totally the wrong way. I am not being
>>>> rude.
>>>>
>>>> On Mon, Jan 31, 2022 at 7:42 PM ramsha azhar 
>>>> wrote:
>>>>
>>>>> Gide me Django develpers. I just want to display my pictures that are
>>>>> created each time new.
>>>>> My mages are created in my project folder, not in the static folder.
>>>>> how I display images on the HTML page by using the path of my project
>>>>> folder.
>>>>>
>>>>> views.py
>>>>>
>>>>> def Image_display(request):
>>>>>   BASE_DIR =
>>>>> os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
>>>>>   filename = 'Tree.jpg'
>>>>>   filepath = BASE_DIR + '//' + filename
>>>>>   images = Image.objects.all('filepath')
>>>>>   return render(request, "xyz.html", {'images': images})
>>>>>
>>>>> url.py
>>>>> path('Image_display/', views.Image_display, name="Image_display"),
>>>>>
>>>>> HTML page
>>>>> 
>>>>> 
>>>>> 
>>>>> 
>>>>>
>>>>> --
>>>>> You received this message because you are subscribed to the Google
>>>>> Groups "Django users" group.
>>>>> To unsubscribe from this group and stop receiving emails from it, send
>>>>> an email to django-users+unsubscr...@googlegroups.com.
>>>>> To view this discussion on the web visit
>>>>> https://groups.google.com/d/msgid/django-users/8da245ea-ea90-4730-83c0-accafc93b86bn%40googlegroups.com
>>>>> <https://groups.google.com/d/msgid/django-users/8da245ea-ea90-4730-83c0-accafc93b86bn%40googlegroups.com?utm_medium=email_source=footer>
>>>>> .
>>>>>
>>>> --
>>>> You received this message because you are subscribed to the Google
>>>> Groups "Django users" group.
>>>> To unsubscribe from this group and stop receiving emails from it, send
>>>> an email to django-users+unsubscr...@googlegroups.com.
>>>> To view this discussion on the web visit
>>>> https://groups.google.com/d/msgid/django-users/CAKPY9p%3DE1FmUc%3Dqqy1tGYBJbimFX873XXSTDndnn4kVUjo3ZWg%40mail.gmail.com
>>>> <https://groups.google.com/d/msgid/django-users/CAKPY9p%3DE1FmUc%3Dqqy1tGYBJbimFX873XXSTDndnn4kVUjo3ZWg%40mail.gmail.com?utm_medium=email_source=footer>
>>>> .
>>>>
>>> --
>>> You received this message because you are subscribed to the Google
>>> Groups "Django users" group.
>>> To unsubscribe from this group and stop receiving emails from it, send
>>> an email to django-users+unsubscr...@googlegroups.com.
>>> To view this discussion on the web visit
>>> https://groups.google.com/d/msgid/django-users/CAMyb2%3DheLgJo5dMxsCgQ8cm%3Dp0px5EHpLr2frYtDowV8mmC%2BbQ%40mail.gmail.com
>>> <https://groups.google.com/d/msgid/django-users/CAMyb2%3DheLgJo5dMxsCgQ8cm%3Dp0px5EHpLr2frYtDowV8mmC%2BbQ%40mail.gmail.com?utm_medium=email_source=footer>
>>> .
>>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "Django users" group.
>> To unsubscribe from this group and stop receiving emails from it, send an
>> email to django-users+unsubscr...@googlegroups.com.
>> To view this discussion on the web visit
>> https://groups.google.com/d/msgid/django-users/CAKPY9p%3DOofwq7YrTp%3DWoKyO7mgxVovK2wN3-%3Dm9Ed2zTWZ%2BdAg%40mail.gmail.com
>> <https://groups.google.com/d/msgid/django-users/CAKPY9p%3DOofwq7YrTp%3DWoKyO7mgxVovK2wN3-%3Dm9Ed2zTWZ%2BdAg%40mail.gmail.com?utm_medium=email_source=footer>
>> .
>>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/CAMyb2%3Dh18EtBixgvyLF2wn-eLNA-uvwejxszEMeu9-kqyVL5xQ%40mail.gmail.com
> <https://groups.google.com/d/msgid/django-users/CAMyb2%3Dh18EtBixgvyLF2wn-eLNA-uvwejxszEMeu9-kqyVL5xQ%40mail.gmail.com?utm_medium=email_source=footer>
> .
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAKPY9pmoTLTnt_5i%3DNeWtRSSS1BjfyVZ%2BL%3DCSALwnOnZwu6zGw%40mail.gmail.com.


Re: how to Display images other than from static folder.

2022-01-31 Thread Ammar Mohammed
This topic solves your problem .

https://djangocentral.com/managing-media-files-in-django/

Ammar Mohammed
Tel: 0113075979
On 31 Jan 2022, 17:36 +0200, DJANGO DEVELOPER , wrote:
> tell me what you want to get as a result? do you want to display multiple 
> images on HTML template?
>
> On Mon, Jan 31, 2022 at 8:27 PM ramsha azhar  wrote:
> > So guide me the write way ...
> >
> > On Mon, 31 Jan 2022, 7:45 pm DJANGO DEVELOPER,  
> > wrote:
> > > you are doing it the wrong way. totally the wrong way. I am not being 
> > > rude.
> > >
> > > On Mon, Jan 31, 2022 at 7:42 PM ramsha azhar  
> > > wrote:
> > > > Gide me Django develpers. I just want to display my pictures that are 
> > > > created each time new.
> > > > My mages are created in my project folder, not in the static folder.
> > > > how I display images on the HTML page by using the path of my project 
> > > > folder.
> > > >
> > > > views.py
> > > >
> > > > def Image_display(request):
> > > >   BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
> > > >   filename = 'Tree.jpg'
> > > >   filepath = BASE_DIR + '//' + filename
> > > >   images = Image.objects.all('filepath')
> > > >   return render(request, "xyz.html", {'images': images})
> > > >
> > > > url.py
> > > > path('Image_display/', views.Image_display, name="Image_display"),
> > > >
> > > > HTML page
> > > > 
> > > > 
> > > > 
> > > > 
> > > >  --
> > > > You received this message because you are subscribed to the Google 
> > > > Groups "Django users" group.
> > > > To unsubscribe from this group and stop receiving emails from it, send 
> > > > an email to django-users+unsubscr...@googlegroups.com.
> > > > To view this discussion on the web visit 
> > > > https://groups.google.com/d/msgid/django-users/8da245ea-ea90-4730-83c0-accafc93b86bn%40googlegroups.com.
> > >  --
> > > You received this message because you are subscribed to the Google Groups 
> > > "Django users" group.
> > > To unsubscribe from this group and stop receiving emails from it, send an 
> > > email to django-users+unsubscr...@googlegroups.com.
> > > To view this discussion on the web visit 
> > > https://groups.google.com/d/msgid/django-users/CAKPY9p%3DE1FmUc%3Dqqy1tGYBJbimFX873XXSTDndnn4kVUjo3ZWg%40mail.gmail.com.
> >  --
> > You received this message because you are subscribed to the Google Groups 
> > "Django users" group.
> > To unsubscribe from this group and stop receiving emails from it, send an 
> > email to django-users+unsubscr...@googlegroups.com.
> > To view this discussion on the web visit 
> > https://groups.google.com/d/msgid/django-users/CAMyb2%3DheLgJo5dMxsCgQ8cm%3Dp0px5EHpLr2frYtDowV8mmC%2BbQ%40mail.gmail.com.
>  --
> You received this message because you are subscribed to the Google Groups 
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to django-users+unsubscr...@googlegroups.com.
> To view this discussion on the web visit 
> https://groups.google.com/d/msgid/django-users/CAKPY9p%3DOofwq7YrTp%3DWoKyO7mgxVovK2wN3-%3Dm9Ed2zTWZ%2BdAg%40mail.gmail.com.

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/c0a72401-90b1-4900-b2b7-b5dee6ea0c9f%40Spark.


Re: how to Display images other than from static folder.

2022-01-31 Thread Lunga Baliwe
i think you want to use MEDIA_URL, see
https://learndjango.com/tutorials/django-file-and-image-uploads-tutorial
and also check https://docs.djangoproject.com/en/3.2/topics/files/ static
files are things like logos, css and maybe some javascript.

On Mon, Jan 31, 2022 at 5:36 PM DJANGO DEVELOPER 
wrote:

> tell me what you want to get as a result? do you want to display multiple
> images on HTML template?
>
> On Mon, Jan 31, 2022 at 8:27 PM ramsha azhar 
> wrote:
>
>> So guide me the write way ...
>>
>> On Mon, 31 Jan 2022, 7:45 pm DJANGO DEVELOPER, 
>> wrote:
>>
>>> you are doing it the wrong way. totally the wrong way. I am not being
>>> rude.
>>>
>>> On Mon, Jan 31, 2022 at 7:42 PM ramsha azhar 
>>> wrote:
>>>
>>>> Gide me Django develpers. I just want to display my pictures that are
>>>> created each time new.
>>>> My mages are created in my project folder, not in the static folder.
>>>> how I display images on the HTML page by using the path of my project
>>>> folder.
>>>>
>>>> views.py
>>>>
>>>> def Image_display(request):
>>>>   BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
>>>>   filename = 'Tree.jpg'
>>>>   filepath = BASE_DIR + '//' + filename
>>>>   images = Image.objects.all('filepath')
>>>>   return render(request, "xyz.html", {'images': images})
>>>>
>>>> url.py
>>>> path('Image_display/', views.Image_display, name="Image_display"),
>>>>
>>>> HTML page
>>>> 
>>>> 
>>>> 
>>>> 
>>>>
>>>> --
>>>> You received this message because you are subscribed to the Google
>>>> Groups "Django users" group.
>>>> To unsubscribe from this group and stop receiving emails from it, send
>>>> an email to django-users+unsubscr...@googlegroups.com.
>>>> To view this discussion on the web visit
>>>> https://groups.google.com/d/msgid/django-users/8da245ea-ea90-4730-83c0-accafc93b86bn%40googlegroups.com
>>>> <https://groups.google.com/d/msgid/django-users/8da245ea-ea90-4730-83c0-accafc93b86bn%40googlegroups.com?utm_medium=email_source=footer>
>>>> .
>>>>
>>> --
>>> You received this message because you are subscribed to the Google
>>> Groups "Django users" group.
>>> To unsubscribe from this group and stop receiving emails from it, send
>>> an email to django-users+unsubscr...@googlegroups.com.
>>> To view this discussion on the web visit
>>> https://groups.google.com/d/msgid/django-users/CAKPY9p%3DE1FmUc%3Dqqy1tGYBJbimFX873XXSTDndnn4kVUjo3ZWg%40mail.gmail.com
>>> <https://groups.google.com/d/msgid/django-users/CAKPY9p%3DE1FmUc%3Dqqy1tGYBJbimFX873XXSTDndnn4kVUjo3ZWg%40mail.gmail.com?utm_medium=email_source=footer>
>>> .
>>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "Django users" group.
>> To unsubscribe from this group and stop receiving emails from it, send an
>> email to django-users+unsubscr...@googlegroups.com.
>> To view this discussion on the web visit
>> https://groups.google.com/d/msgid/django-users/CAMyb2%3DheLgJo5dMxsCgQ8cm%3Dp0px5EHpLr2frYtDowV8mmC%2BbQ%40mail.gmail.com
>> <https://groups.google.com/d/msgid/django-users/CAMyb2%3DheLgJo5dMxsCgQ8cm%3Dp0px5EHpLr2frYtDowV8mmC%2BbQ%40mail.gmail.com?utm_medium=email_source=footer>
>> .
>>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/CAKPY9p%3DOofwq7YrTp%3DWoKyO7mgxVovK2wN3-%3Dm9Ed2zTWZ%2BdAg%40mail.gmail.com
> <https://groups.google.com/d/msgid/django-users/CAKPY9p%3DOofwq7YrTp%3DWoKyO7mgxVovK2wN3-%3Dm9Ed2zTWZ%2BdAg%40mail.gmail.com?utm_medium=email_source=footer>
> .
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CANDnEWee3Dp3B55RFDtwjmcNTz%2BNd%2BrGiufNfv%3DC7%2Bh6KeaYBQ%40mail.gmail.com.


Re: how to Display images other than from static folder.

2022-01-31 Thread DJANGO DEVELOPER
tell me what you want to get as a result? do you want to display multiple
images on HTML template?

On Mon, Jan 31, 2022 at 8:27 PM ramsha azhar 
wrote:

> So guide me the write way ...
>
> On Mon, 31 Jan 2022, 7:45 pm DJANGO DEVELOPER, 
> wrote:
>
>> you are doing it the wrong way. totally the wrong way. I am not being
>> rude.
>>
>> On Mon, Jan 31, 2022 at 7:42 PM ramsha azhar 
>> wrote:
>>
>>> Gide me Django develpers. I just want to display my pictures that are
>>> created each time new.
>>> My mages are created in my project folder, not in the static folder.
>>> how I display images on the HTML page by using the path of my project
>>> folder.
>>>
>>> views.py
>>>
>>> def Image_display(request):
>>>   BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
>>>   filename = 'Tree.jpg'
>>>   filepath = BASE_DIR + '//' + filename
>>>   images = Image.objects.all('filepath')
>>>   return render(request, "xyz.html", {'images': images})
>>>
>>> url.py
>>> path('Image_display/', views.Image_display, name="Image_display"),
>>>
>>> HTML page
>>> 
>>> 
>>> 
>>> 
>>>
>>> --
>>> You received this message because you are subscribed to the Google
>>> Groups "Django users" group.
>>> To unsubscribe from this group and stop receiving emails from it, send
>>> an email to django-users+unsubscr...@googlegroups.com.
>>> To view this discussion on the web visit
>>> https://groups.google.com/d/msgid/django-users/8da245ea-ea90-4730-83c0-accafc93b86bn%40googlegroups.com
>>> <https://groups.google.com/d/msgid/django-users/8da245ea-ea90-4730-83c0-accafc93b86bn%40googlegroups.com?utm_medium=email_source=footer>
>>> .
>>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "Django users" group.
>> To unsubscribe from this group and stop receiving emails from it, send an
>> email to django-users+unsubscr...@googlegroups.com.
>> To view this discussion on the web visit
>> https://groups.google.com/d/msgid/django-users/CAKPY9p%3DE1FmUc%3Dqqy1tGYBJbimFX873XXSTDndnn4kVUjo3ZWg%40mail.gmail.com
>> <https://groups.google.com/d/msgid/django-users/CAKPY9p%3DE1FmUc%3Dqqy1tGYBJbimFX873XXSTDndnn4kVUjo3ZWg%40mail.gmail.com?utm_medium=email_source=footer>
>> .
>>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/CAMyb2%3DheLgJo5dMxsCgQ8cm%3Dp0px5EHpLr2frYtDowV8mmC%2BbQ%40mail.gmail.com
> <https://groups.google.com/d/msgid/django-users/CAMyb2%3DheLgJo5dMxsCgQ8cm%3Dp0px5EHpLr2frYtDowV8mmC%2BbQ%40mail.gmail.com?utm_medium=email_source=footer>
> .
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAKPY9p%3DOofwq7YrTp%3DWoKyO7mgxVovK2wN3-%3Dm9Ed2zTWZ%2BdAg%40mail.gmail.com.


Re: how to Display images other than from static folder.

2022-01-31 Thread ramsha azhar
So guide me the write way ...

On Mon, 31 Jan 2022, 7:45 pm DJANGO DEVELOPER, 
wrote:

> you are doing it the wrong way. totally the wrong way. I am not being rude.
>
> On Mon, Jan 31, 2022 at 7:42 PM ramsha azhar 
> wrote:
>
>> Gide me Django develpers. I just want to display my pictures that are
>> created each time new.
>> My mages are created in my project folder, not in the static folder.
>> how I display images on the HTML page by using the path of my project
>> folder.
>>
>> views.py
>>
>> def Image_display(request):
>>   BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
>>   filename = 'Tree.jpg'
>>   filepath = BASE_DIR + '//' + filename
>>   images = Image.objects.all('filepath')
>>   return render(request, "xyz.html", {'images': images})
>>
>> url.py
>> path('Image_display/', views.Image_display, name="Image_display"),
>>
>> HTML page
>> 
>> 
>> 
>> 
>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "Django users" group.
>> To unsubscribe from this group and stop receiving emails from it, send an
>> email to django-users+unsubscr...@googlegroups.com.
>> To view this discussion on the web visit
>> https://groups.google.com/d/msgid/django-users/8da245ea-ea90-4730-83c0-accafc93b86bn%40googlegroups.com
>> <https://groups.google.com/d/msgid/django-users/8da245ea-ea90-4730-83c0-accafc93b86bn%40googlegroups.com?utm_medium=email_source=footer>
>> .
>>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/CAKPY9p%3DE1FmUc%3Dqqy1tGYBJbimFX873XXSTDndnn4kVUjo3ZWg%40mail.gmail.com
> <https://groups.google.com/d/msgid/django-users/CAKPY9p%3DE1FmUc%3Dqqy1tGYBJbimFX873XXSTDndnn4kVUjo3ZWg%40mail.gmail.com?utm_medium=email_source=footer>
> .
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAMyb2%3DheLgJo5dMxsCgQ8cm%3Dp0px5EHpLr2frYtDowV8mmC%2BbQ%40mail.gmail.com.


Re: how to Display images other than from static folder.

2022-01-31 Thread DJANGO DEVELOPER
you are doing it the wrong way. totally the wrong way. I am not being rude.

On Mon, Jan 31, 2022 at 7:42 PM ramsha azhar 
wrote:

> Gide me Django develpers. I just want to display my pictures that are
> created each time new.
> My mages are created in my project folder, not in the static folder.
> how I display images on the HTML page by using the path of my project
> folder.
>
> views.py
>
> def Image_display(request):
>   BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
>   filename = 'Tree.jpg'
>   filepath = BASE_DIR + '//' + filename
>   images = Image.objects.all('filepath')
>   return render(request, "xyz.html", {'images': images})
>
> url.py
> path('Image_display/', views.Image_display, name="Image_display"),
>
> HTML page
> 
> 
> 
> 
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/8da245ea-ea90-4730-83c0-accafc93b86bn%40googlegroups.com
> <https://groups.google.com/d/msgid/django-users/8da245ea-ea90-4730-83c0-accafc93b86bn%40googlegroups.com?utm_medium=email_source=footer>
> .
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAKPY9p%3DE1FmUc%3Dqqy1tGYBJbimFX873XXSTDndnn4kVUjo3ZWg%40mail.gmail.com.


how to Display images other than from static folder.

2022-01-31 Thread ramsha azhar
Gide me Django develpers. I just want to display my pictures that are 
created each time new.
My mages are created in my project folder, not in the static folder.
how I display images on the HTML page by using the path of my project 
folder.

views.py

def Image_display(request):
  BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
  filename = 'Tree.jpg'
  filepath = BASE_DIR + '//' + filename
  images = Image.objects.all('filepath')
  return render(request, "xyz.html", {'images': images})

url.py
path('Image_display/', views.Image_display, name="Image_display"),

HTML page
 
 



-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/8da245ea-ea90-4730-83c0-accafc93b86bn%40googlegroups.com.


Re: Multi images upload in Django vs Vue.js

2021-12-16 Thread Ram
Also, I wanted to add that we are using Django FWK only but not the RESTFUL
one?

Best regards,
~Ram



On Thu, Dec 16, 2021 at 9:10 PM Ram  wrote:

> Hi,
>
> Is anyone successful implementing multi images upload in a WebApp using
> Vue.js and Django? We tried so many ways and which ever way we try images
> are being saved "null" in the backend. So I'm wondering whether this is a
> bug in Django or incompatibility with Vue.js? Could you share if anyone has
> successful with this?
>
> Best regards,
> ~Ram
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CA%2BOi5F34a-CtkA%2BUCae6nuVRYNN5MVf8QargyBOk8%2BqoVVmNFw%40mail.gmail.com.


Multi images upload in Django vs Vue.js

2021-12-16 Thread Ram
Hi,

Is anyone successful implementing multi images upload in a WebApp using
Vue.js and Django? We tried so many ways and which ever way we try images
are being saved "null" in the backend. So I'm wondering whether this is a
bug in Django or incompatibility with Vue.js? Could you share if anyone has
successful with this?

Best regards,
~Ram

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CA%2BOi5F1jpLXaa_dx3_DZJ%2B2cGij2rRANP1KVSFfY4Q3WVOZ9nQ%40mail.gmail.com.


Question for Upload images issue

2021-11-23 Thread Alam Khazi
Hi,
By using Vuejs, Axios and Django, we're uploading "multiple images" using
Vuejs form in one upload/browse attempt. After uploading, the images are
getting in a list and then the list of images names are stored into backend
in ImageField.  The image names are saving into database but not saving
into Media Folder. Here is snippet of the code.

Vuejs
```
  
Files


  {{ name }}

  
  

  
  
  Submit
```
Axiox
```

new Vue({
  el: '#app',
  data() {
return {
  files: [],
  images: [],
}
  },
  computed: {
filesNames() {
  const fn = []
  for (let i = 0; i < this.files.length; ++i) {
fn.push(this.files.item(i).name)

  }
  return fn
}
  },
  methods: {
handleFileUploads(event) {
  this.files = event.target.files;
  this.images = [...this.files].map(URL.createObjectURL);
},
submitFile() {
  let formData = new FormData();
  for (var i = 0; i < this.files.length; i++) {
let file = this.files[i];
formData.append('files[' + i + ']', file);
  }
 submitForm: function(){
  let formData = new FormData();
  const fna = []
  for (let i = 0; i < this.files.length; ++i) {
fna.push(this.files.item(i).name)
  }
  console.log('fna');
  console.log(fna);
axios({
method : "POST",
url: "{% url 'service-ad' %}",
headers: {'X-CSRFTOKEN': '{{ csrf_token }}',
'Content-Type': 'multipart/form-data'},
        data : {
"images": fna,
},
  }).then(response => {
console.log('SUCCESS!!');
  }).catch(err => {
console.log('FAILURE!!');
  });
}
  }
})

```
Where as in other case we have similar functionality of uploading
'multiple images' in one upload/browse attempt, but here, we are using HTML
form and the images names are saved in database as well as in Media Folder.

Django
```
def servicevue(request):
if request.method == "POST":
data = json.loads(request.body)
images = data['images']
img_length = len(images)
if img_length == 1:
image_name = images[0]
image_name2 = ''
elif img_length == 2:
    image_name = images[0]
image_name2 = images[1]
else:
image_name = ''
image_name2 = ''

savehotel = Hotel(
  image=image_name,
  image2=image_name2,
  )
savehotel.save()
messages.success(request, """Your Ad is successfully posted.""")
return JsonResponse(safe=False)
return render(request, 'servicead.html')
```
So we are wondering what could be the issue. We hope our code is correctly
implemented. Please help me out whether this is any way to unblock this
issue?

Best regards,
Salima

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CABscGkRXhvC6zALxCXvQN6-DmB%2BxedTSWO8KrPS2Nih0imZtXA%40mail.gmail.com.


Re: Embedded Images in emails

2021-10-04 Thread Kasper Laudrup

On 04/10/2021 12.30, Bit Rate wrote:

[Errno 2] No such file or directory: '/media/logo256.png'

I have tried everything and is now out of ideas, hoping someone here ran 
into the same issue and can help me please.




Have you tried checking if there is a file located at '/media/logo256.png'?

Is that part of "everything"?

Kind regards,

Kasper Laudrup

--
You received this message because you are subscribed to the Google Groups "Django 
users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/4b12317e-de36-61f0-c720-7c17c5ccff6f%40stacktrace.dk.


OpenPGP_0xE5D9CAC64AAA55EB.asc
Description: OpenPGP public key


OpenPGP_signature
Description: OpenPGP digital signature


Embedded Images in emails

2021-10-04 Thread Bit Rate
I recently change my email from plain text to html.
This includes the registration verification email, as well as any other 
email regarding updates and notifications.

It works fine in development, but not in production.
In my production setting, django is unable to find the image and gives me 
the following error:
Exception Type:
FileNotFoundErrorException Value:
[Errno 2] No such file or directory: '/media/logo256.png'

I have tried everything and is now out of ideas, hoping someone here ran 
into the same issue and can help me please.

Here is my code from the views.py file:

def post(self, request, *args, **kwargs):
form = self.form_class(request.POST)
if form.is_valid():

user = form.save(commit=False)
user.user_email = user.email
user.is_active = False # Deactivate account till it is confirmed
user.save()

# Email with html template
from_email = settings.DEFAULT_FROM_EMAIL
to_email = user.email
subject = 'Activate Your Telos Central Account'

image_path = 'media'
image_name = 'logo256.png'
file_path = os.path.join(image_path, image_name)

text_content = "Text content: Hi {{ user.username }}, Please click 
on the link to confirm your registration, https://{{ domain }}{% url 'activate' 
uidb64=uid token=token %}  If you think, it's not you, then just ignore this 
email."
html_tmp  = get_template('email/account_activation_email.html')

ctx = {
'user': user,
'domain': 'teloscentral.com',
'uid': urlsafe_base64_encode(force_bytes(user.pk)),
'token': account_activation_token.make_token(user),
}
html_content = html_tmp.render(ctx)

msg = EmailMultiAlternatives(subject,
 text_content,
 from_email,
 [to_email])

msg.attach_alternative(html_content, 'text/html')
msg.content_subtype = 'html'  # set the primary content to be 
text/html
msg.mixed_subtype = 'related' # it is an important part that 
ensures embedding of an image

# attached image to the message before sending the mail
with open(file_path, mode='rb') as f:
image = MIMEImage(f.read())
msg.attach(image)
image.add_header('Content-ID', 
'<{name}>'.format(name=image_name))
image.add_header('Content-Disposition', 'inline', 
filename=image_name)


msg.send()

# Show message that mail has been sent
messages.success(request, ('Please Confirm your email to complete 
registration.'))

# Go to login page
return redirect('login')

return render(request, self.template_name, {'form': form})

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/52bd056e-421c-4e5e-8777-ee4288899f06n%40googlegroups.com.


Re: How to embed logo on uploaded images

2021-04-19 Thread RANGA BHARATH JINKA
Hi,

Try this. This may be useful for you.
https://www.blog.pythonlibrary.org/2017/10/17/how-to-watermark-your-photos-with-python/

All the best

On Mon, Apr 19, 2021 at 12:09 PM Ram  wrote:

> Hi,
>
> Registered users in web application upload images to  sell market place
> items and we need to add our company logo to  pretect from  stealing
> against copy right. Is there any library availlable in Python to handle
> this feature.
>
> Best regards,
> ~Ram
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/CA%2BOi5F0RkEWTeFP3HUfBM4-VKvuRk4TsJ6vneW_p7D-OZEhVWQ%40mail.gmail.com
> <https://groups.google.com/d/msgid/django-users/CA%2BOi5F0RkEWTeFP3HUfBM4-VKvuRk4TsJ6vneW_p7D-OZEhVWQ%40mail.gmail.com?utm_medium=email_source=footer>
> .
>


-- 
Thanks and Regards

J. Ranga Bharath
cell: 9110334114

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAK5m314jtyMYLb4OvGpm-Vh6FYndi23jrLsSOtKJ0qyDkQ1aRQ%40mail.gmail.com.


How to embed logo on uploaded images

2021-04-19 Thread Ram
Hi,

Registered users in web application upload images to  sell market place
items and we need to add our company logo to  pretect from  stealing
against copy right. Is there any library availlable in Python to handle
this feature.

Best regards,
~Ram

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CA%2BOi5F0RkEWTeFP3HUfBM4-VKvuRk4TsJ6vneW_p7D-OZEhVWQ%40mail.gmail.com.


How to give select images option in django model forms ?

2021-03-14 Thread Kumar Gaurav
Hii Everyone,

I have a Model Form, one field is to upload image. Right now , user can 
select images from their system and upload but I want to give a  certain 
number of images as a dropdown option (showing the images in preview) to 
select from.

How can I implement this ?? and the best solution to implement this ??

Can anyone help ..

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/3da6d701-2dfe-460f-ba8c-672cd11a944cn%40googlegroups.com.


Re: Upload images

2021-02-12 Thread Kasper Laudrup

On 12/02/2021 05.12, mtp...@gmail.com wrote:
How do I check if the files are valid images or not before creating the 
organization object.




When asking someone for help, at least have the courtesy to reply the 
suggestions you're given before asking an unrelated question.


This will greatly improve the chances of getting help from someone.

Kind regards,

Kasper Laudrup

--
You received this message because you are subscribed to the Google Groups "Django 
users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/f760733a-5126-efaa-612e-d7c53960c9f0%40stacktrace.dk.


Re: Upload images

2021-02-11 Thread mtp...@gmail.com
How do I check if the files are valid images or not before creating the 
organization objec
On Friday, February 12, 2021 at 12:21:19 AM UTC+3 theresa...@gmail.com 
wrote:

> What is the error message? Is it in your admin site you are getting issues 
> uploading images or when rendered in the template?
>
> For me I use this in my model:
> image = models.ImageField(null=True, blank=True, upload_to="images/")
>
> the upload_to specifies wherein the static folder I want to upload the 
> images
>
> On Thu, 11 Feb 2021 at 19:30, mtp...@gmail.com  wrote:
>
>> Hello everyone,
>>  I have implemented an endpoint to register an organization how do I make 
>> it posssible to upload the images considering the org model as shown below.
>>
>> ```
>>
>> class Organization(Group):
>> email = models.EmailField(max_length=60, blank=False, null=False)
>> admin = models.ManyToManyField(settings.AUTH_USER_MODEL)
>> users = models.ManyToManyField(settings.AUTH_USER_MODEL,related_name
>> ='org_users')
>> is_active = models.BooleanField(default=False)
>> short_name = models.CharField(max_length=200,blank=True)
>> location = models.CharField(max_length=200,blank=True, null=True)
>> tag_line = models.TextField(null=True,blank=True)
>> company_phone =  models.CharField(max_length=15, blank=True, null
>> =True)
>> po_box = models.CharField(max_length=15, blank=True, null=True)
>> first_logo = models.ImageField(null=True,blank=True)
>> second_logo = models.ImageField(null=True,blank=True)
>>     third_logo = models.ImageField(null=True,blank=True)
>> history = HistoricalRecords()
>>
>> ```
>>
>
>> I have implemented the following view but saving the images part is an 
>> issue:
>>
>> ```
>> class OrganizationRegistration(generics.CreateAPIView):
>> queryset = Organization.objects.all()
>> permission_classes = (permissions.AllowAny,)
>> serializer_class = OrgRegistrationSerializer
>>
>> """
>> {
>> "admin":{
>> "username":"kapy...@abyssmail.com",
>> "first_name":"Cindy",
>> "last_name":"Georgia",
>> "password":"password",
>> "email":"kapy...@abyssmail.com"
>> },
>> "org":{
>> "name":"ARIZONA LAW SOCIETY",
>> "short_name":"ALS",
>> "tag_line":"ALS",
>> "email":"kapy...@abyssmail.com",
>> "company_phone": "+25475533222",
>> "po_box": "200",
>> "location":"NAKURU",
>> "first_logo": "
>> https://www.mintformations.co.uk/blog/wp-content/uploads/2020/05/shutterstock_583717939.jpg
>> ",
>> "second_logo": "
>> https://www.mintformations.co.uk/blog/wp-content/uploads/2020/05/shutterstock_583717939.jpg
>> ",
>> "third_logo": "
>> https://www.mintformations.co.uk/blog/wp-content/uploads/2020/05/shutterstock_583717939.jpg
>> "
>> }
>> }
>> """
>>
>> def post(self, request, format=None, *args, **kwargs):
>> try:
>> admins = Group.objects.get(name__iexact='admin')
>> admin_role = Role.objects.get(name__iexact="admin")
>> 
>> except:
>> # The admin group is
>> admins = Group.objects.create(name="admin")
>>
>> admin_role = Role.objects.create(name="admin")
>>
>> # Validate USer and Org
>> if Organization.objects.filter(name__iexact
>> =request.data['org']['name']).exists() is True:
>>
>> res = {"data": None, "msg":"Organization with that name already 
>> registered","success": False}
>> return Response(data=res,status=status.HTTP_400_BAD_REQUEST)
>>
>> if User.objects.filter(username__iexact
>> =request.data['admin']['username']).exists() is True:
>>
>> res = {"data": None, "msg":"User with that name already 
>> registered.","success": False}
>> return Response(data=re

Re: Upload images

2021-02-11 Thread mtp...@gmail.com
How do I check if the files are valid images or not before creating the 
organization object.

On Friday, February 12, 2021 at 12:21:19 AM UTC+3 theresa...@gmail.com 
wrote:

> What is the error message? Is it in your admin site you are getting issues 
> uploading images or when rendered in the template?
>
> For me I use this in my model:
> image = models.ImageField(null=True, blank=True, upload_to="images/")
>
> the upload_to specifies wherein the static folder I want to upload the 
> images
>
> On Thu, 11 Feb 2021 at 19:30, mtp...@gmail.com  wrote:
>
>> Hello everyone,
>>  I have implemented an endpoint to register an organization how do I make 
>> it posssible to upload the images considering the org model as shown below.
>>
>> ```
>>
>> class Organization(Group):
>> email = models.EmailField(max_length=60, blank=False, null=False)
>> admin = models.ManyToManyField(settings.AUTH_USER_MODEL)
>> users = models.ManyToManyField(settings.AUTH_USER_MODEL,related_name
>> ='org_users')
>> is_active = models.BooleanField(default=False)
>> short_name = models.CharField(max_length=200,blank=True)
>> location = models.CharField(max_length=200,blank=True, null=True)
>> tag_line = models.TextField(null=True,blank=True)
>> company_phone =  models.CharField(max_length=15, blank=True, null
>> =True)
>> po_box = models.CharField(max_length=15, blank=True, null=True)
>> first_logo = models.ImageField(null=True,blank=True)
>> second_logo = models.ImageField(null=True,blank=True)
>>     third_logo = models.ImageField(null=True,blank=True)
>> history = HistoricalRecords()
>>
>> ```
>>
>
>> I have implemented the following view but saving the images part is an 
>> issue:
>>
>> ```
>> class OrganizationRegistration(generics.CreateAPIView):
>> queryset = Organization.objects.all()
>> permission_classes = (permissions.AllowAny,)
>> serializer_class = OrgRegistrationSerializer
>>
>> """
>> {
>> "admin":{
>> "username":"kapy...@abyssmail.com",
>> "first_name":"Cindy",
>> "last_name":"Georgia",
>> "password":"password",
>> "email":"kapy...@abyssmail.com"
>> },
>> "org":{
>> "name":"ARIZONA LAW SOCIETY",
>> "short_name":"ALS",
>> "tag_line":"ALS",
>> "email":"kapy...@abyssmail.com",
>> "company_phone": "+25475533222",
>> "po_box": "200",
>> "location":"NAKURU",
>> "first_logo": "
>> https://www.mintformations.co.uk/blog/wp-content/uploads/2020/05/shutterstock_583717939.jpg
>> ",
>> "second_logo": "
>> https://www.mintformations.co.uk/blog/wp-content/uploads/2020/05/shutterstock_583717939.jpg
>> ",
>> "third_logo": "
>> https://www.mintformations.co.uk/blog/wp-content/uploads/2020/05/shutterstock_583717939.jpg
>> "
>> }
>> }
>> """
>>
>> def post(self, request, format=None, *args, **kwargs):
>> try:
>> admins = Group.objects.get(name__iexact='admin')
>> admin_role = Role.objects.get(name__iexact="admin")
>> 
>> except:
>> # The admin group is
>> admins = Group.objects.create(name="admin")
>>
>> admin_role = Role.objects.create(name="admin")
>>
>> # Validate USer and Org
>> if Organization.objects.filter(name__iexact
>> =request.data['org']['name']).exists() is True:
>>
>> res = {"data": None, "msg":"Organization with that name already 
>> registered","success": False}
>> return Response(data=res,status=status.HTTP_400_BAD_REQUEST)
>>
>> if User.objects.filter(username__iexact
>> =request.data['admin']['username']).exists() is True:
>>
>> res = {"data": None, "msg":"User with that name already 
>> registered.","success": False}
>> return Response(data=re

Re: Upload images

2021-02-11 Thread Theresa Taye
What is the error message? Is it in your admin site you are getting issues
uploading images or when rendered in the template?

For me I use this in my model:
image = models.ImageField(null=True, blank=True, upload_to="images/")

the upload_to specifies wherein the static folder I want to upload the
images

On Thu, 11 Feb 2021 at 19:30, mtp...@gmail.com  wrote:

> Hello everyone,
>  I have implemented an endpoint to register an organization how do I make
> it posssible to upload the images considering the org model as shown below.
>
> ```
>
> class Organization(Group):
> email = models.EmailField(max_length=60, blank=False, null=False)
> admin = models.ManyToManyField(settings.AUTH_USER_MODEL)
> users = models.ManyToManyField(settings.AUTH_USER_MODEL,related_name
> ='org_users')
> is_active = models.BooleanField(default=False)
> short_name = models.CharField(max_length=200,blank=True)
> location = models.CharField(max_length=200,blank=True, null=True)
> tag_line = models.TextField(null=True,blank=True)
> company_phone =  models.CharField(max_length=15, blank=True, null
> =True)
> po_box = models.CharField(max_length=15, blank=True, null=True)
> first_logo = models.ImageField(null=True,blank=True)
> second_logo = models.ImageField(null=True,blank=True)
> third_logo = models.ImageField(null=True,blank=True)
> history = HistoricalRecords()
>
> ```
>
> I have implemented the following view but saving the images part is an
> issue:
>
> ```
> class OrganizationRegistration(generics.CreateAPIView):
> queryset = Organization.objects.all()
> permission_classes = (permissions.AllowAny,)
> serializer_class = OrgRegistrationSerializer
>
> """
> {
> "admin":{
> "username":"kapyj...@abyssmail.com",
> "first_name":"Cindy",
> "last_name":"Georgia",
> "password":"password",
> "email":"kapyj...@abyssmail.com"
> },
> "org":{
> "name":"ARIZONA LAW SOCIETY",
> "short_name":"ALS",
> "tag_line":"ALS",
> "email":"kapyj...@abyssmail.com",
> "company_phone": "+25475533222",
> "po_box": "200",
> "location":"NAKURU",
> "first_logo": "
> https://www.mintformations.co.uk/blog/wp-content/uploads/2020/05/shutterstock_583717939.jpg
> ",
> "second_logo": "
> https://www.mintformations.co.uk/blog/wp-content/uploads/2020/05/shutterstock_583717939.jpg
> ",
> "third_logo": "
> https://www.mintformations.co.uk/blog/wp-content/uploads/2020/05/shutterstock_583717939.jpg
> "
> }
> }
> """
>
> def post(self, request, format=None, *args, **kwargs):
> try:
> admins = Group.objects.get(name__iexact='admin')
> admin_role = Role.objects.get(name__iexact="admin")
>
> except:
> # The admin group is
> admins = Group.objects.create(name="admin")
>
> admin_role = Role.objects.create(name="admin")
>
> # Validate USer and Org
> if Organization.objects.filter(name__iexact
> =request.data['org']['name']).exists() is True:
>
> res = {"data": None, "msg":"Organization with that name already 
> registered","success": False}
> return Response(data=res,status=status.HTTP_400_BAD_REQUEST)
>
> if User.objects.filter(username__iexact
> =request.data['admin']['username']).exists() is True:
>
> res = {"data": None, "msg":"User with that name already 
> registered.","success": False}
> return Response(data=res,status=status.HTTP_400_BAD_REQUEST)
>
>
> try:
> admin = User.objects.create(
> username=request.data['admin']['username'],
> email=request.data['admin']['email'],
> first_name=request.data['admin']['first_name'],
> last_name=request.data['admin']['last_name'],
> )
>
> location_name = request.data['org']['location'].upper()
>
> location_obj, _  = Location.objects.get_or_create(name
> =location_name)
> area_name = location_obj.name
>
&

Re: Upload images

2021-02-11 Thread Kasper Laudrup

On 11/02/2021 19.29, mtp...@gmail.com wrote:


I have implemented the following view but saving the images part is an 
issue:




What's the issue? Knowing that would make it easier for someone to help you.

Having a quick look at the code, I would start by removing the 
try/except block until you have a way to actually handle the errors you 
expect to encounter.


Currently you either ignore exceptions making it impossible to debug 
errors, or catch them and tell the client/user that they're to blame for 
whatever unknown exception was raised (with a 400 status code) without 
leaving any trace of what actually went wrong for you to fix. That's not 
error handling.


Kind regards,

Kasper Laudrup

--
You received this message because you are subscribed to the Google Groups "Django 
users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/8eabb032-3867-cadc-a74b-dcf9256ad6e9%40stacktrace.dk.


Upload images

2021-02-11 Thread mtp...@gmail.com
Hello everyone,
 I have implemented an endpoint to register an organization how do I make 
it posssible to upload the images considering the org model as shown below.

```

class Organization(Group):
email = models.EmailField(max_length=60, blank=False, null=False)
admin = models.ManyToManyField(settings.AUTH_USER_MODEL)
users = models.ManyToManyField(settings.AUTH_USER_MODEL,related_name
='org_users')
is_active = models.BooleanField(default=False)
short_name = models.CharField(max_length=200,blank=True)
location = models.CharField(max_length=200,blank=True, null=True)
tag_line = models.TextField(null=True,blank=True)
company_phone =  models.CharField(max_length=15, blank=True, null=True)
po_box = models.CharField(max_length=15, blank=True, null=True)
first_logo = models.ImageField(null=True,blank=True)
second_logo = models.ImageField(null=True,blank=True)
third_logo = models.ImageField(null=True,blank=True)
history = HistoricalRecords()

```

I have implemented the following view but saving the images part is an 
issue:

```
class OrganizationRegistration(generics.CreateAPIView):
queryset = Organization.objects.all()
permission_classes = (permissions.AllowAny,)
serializer_class = OrgRegistrationSerializer

"""
{
"admin":{
"username":"kapyj...@abyssmail.com",
"first_name":"Cindy",
"last_name":"Georgia",
"password":"password",
"email":"kapyj...@abyssmail.com"
},
"org":{
"name":"ARIZONA LAW SOCIETY",
"short_name":"ALS",
"tag_line":"ALS",
"email":"kapyj...@abyssmail.com",
"company_phone": "+25475533222",
"po_box": "200",
"location":"NAKURU",
"first_logo": 
"https://www.mintformations.co.uk/blog/wp-content/uploads/2020/05/shutterstock_583717939.jpg;,
"second_logo": 
"https://www.mintformations.co.uk/blog/wp-content/uploads/2020/05/shutterstock_583717939.jpg;,
"third_logo": 
"https://www.mintformations.co.uk/blog/wp-content/uploads/2020/05/shutterstock_583717939.jpg;
}
}
"""

def post(self, request, format=None, *args, **kwargs):
try:
admins = Group.objects.get(name__iexact='admin')
admin_role = Role.objects.get(name__iexact="admin")

except:
# The admin group is
admins = Group.objects.create(name="admin")

admin_role = Role.objects.create(name="admin")

# Validate USer and Org
if Organization.objects.filter(name__iexact
=request.data['org']['name']).exists() is True:
res = {"data": None, "msg":"Organization with that name already 
registered","success": False}
return Response(data=res,status=status.HTTP_400_BAD_REQUEST)

if User.objects.filter(username__iexact
=request.data['admin']['username']).exists() is True:
res = {"data": None, "msg":"User with that name already 
registered.","success": False}
return Response(data=res,status=status.HTTP_400_BAD_REQUEST)


try:
admin = User.objects.create(
username=request.data['admin']['username'],
email=request.data['admin']['email'],
first_name=request.data['admin']['first_name'],
last_name=request.data['admin']['last_name'],
)

location_name = request.data['org']['location'].upper()

location_obj, _  = Location.objects.get_or_create(name
=location_name)
area_name = location_obj.name

# Create Random Password   
password = User.objects.make_random_password(length=10)

admin.set_password(password)
admin.save()
admin.groups.add(admins)
admin.roles.add(admin_role)
except Exception as e:
return Response(data={"msg":str
(e),"success":False, "data": None},status=status.HTTP_400_BAD_REQUEST)

try: 

first_file_logo = request.data['org']['first_logo']
second_file_logo = request.data['org']['second_logo']
third_file_logo = request.data['org']['third_logo']

org = Organization.objects.create(
name=request.data['org']['name'],
email=request.data['org']['email'],
location=request.data['org']['location'],
short_nam

Re: with templated-docs: how to insert images from an ImageField

2021-01-19 Thread Diptesh Choudhuri
https://templated-docs.readthedocs.io/en/latest/templatetags.html#image
This looks useful.

On Wednesday, January 20, 2021 at 4:13:04 AM UTC+5:30 fenrir...@gmail.com 
wrote:

> I'm generating reports using (a patched for django 3x fork of) 
> templated-docs <https://pypi.org/project/templated_docs/>. This module 
> lets you create OTD templates in LibreOffice and render them to PDF inside 
> a django view.
>
> This works great for complex documents with text, but I have no clue how 
> to insert images as well. The images come from an ImageField in the table 
> from which I get the info 
> that goes into the document.
> does anyone have experience how to create reports with images? I'm open 
> towards something else than templated-docs
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/6d9520ac-82ce-4702-88e3-cf559a1b6999n%40googlegroups.com.


with templated-docs: how to insert images from an ImageField

2021-01-19 Thread Fenrir Sivar
I'm generating reports using (a patched for django 3x fork of) 
templated-docs <https://pypi.org/project/templated_docs/>. This module lets 
you create OTD templates in LibreOffice and render them to PDF inside a 
django view.

This works great for complex documents with text, but I have no clue how to 
insert images as well. The images come from an ImageField in the table from 
which I get the info 
that goes into the document.
does anyone have experience how to create reports with images? I'm open 
towards something else than templated-docs

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/93bd82d3-3867-4c3a-a687-7fa01371991en%40googlegroups.com.


Re: hello guys, how can I upload multiple images using single button? help me please

2021-01-09 Thread Joseph Wayodi
Post your code here, and someone will help you figure out why it does
not work like you expect.

On Sat, 9 Jan 2021 at 22:07, Chelsea Fan  wrote:
>
> I tried it, it works but it saves last file twice, for example if I upload 2 
> file it saves 3
>
> On Sat, Jan 9, 2021 at 7:53 PM Joseph Wayodi  wrote:
>>
>> The Django docs show how to do this:
>> .
>>
>> On Thu, 7 Jan 2021 at 15:24, Chelsea Fan  
>> wrote:
>> >
>> >
>> > --
>> > You received this message because you are subscribed to the Google Groups 
>> > "Django users" group.
>> > To unsubscribe from this group and stop receiving emails from it, send an 
>> > email to django-users+unsubscr...@googlegroups.com.
>> > To view this discussion on the web visit 
>> > https://groups.google.com/d/msgid/django-users/CAJwZndca8SC7ifBzyW4ut%3DJXy-2E3RPPvq2tHrpCyxyqABQnzw%40mail.gmail.com.
>>
>> --
>> You received this message because you are subscribed to the Google Groups 
>> "Django users" group.
>> To unsubscribe from this group and stop receiving emails from it, send an 
>> email to django-users+unsubscr...@googlegroups.com.
>> To view this discussion on the web visit 
>> https://groups.google.com/d/msgid/django-users/CAOXm%2Bp8tF1Zpt1gmFH%3DTc6fin3ijf%2B3kDrc9j_yRR2ZBbxVfSA%40mail.gmail.com.
>
> --
> You received this message because you are subscribed to the Google Groups 
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to django-users+unsubscr...@googlegroups.com.
> To view this discussion on the web visit 
> https://groups.google.com/d/msgid/django-users/CAJwZndefeU5b4a9J_JjyMpTHyr-dwQ5GCs-7eJf0Kvf3qdjUFQ%40mail.gmail.com.

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAOXm%2Bp8W8jtHYSB2dW5rHo1NmdPGH3xB4b_opJ-0BH%2B%2BR6YS8Q%40mail.gmail.com.


Re: hello guys, how can I upload multiple images using single button? help me please

2021-01-09 Thread Chelsea Fan
I tried it, it works but it saves last file twice, for example if I upload
2 file it saves 3

On Sat, Jan 9, 2021 at 7:53 PM Joseph Wayodi  wrote:

> The Django docs show how to do this:
> <
> https://docs.djangoproject.com/en/3.1/topics/http/file-uploads/#uploading-multiple-files
> >.
>
> On Thu, 7 Jan 2021 at 15:24, Chelsea Fan 
> wrote:
> >
> >
> > --
> > You received this message because you are subscribed to the Google
> Groups "Django users" group.
> > To unsubscribe from this group and stop receiving emails from it, send
> an email to django-users+unsubscr...@googlegroups.com.
> > To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/CAJwZndca8SC7ifBzyW4ut%3DJXy-2E3RPPvq2tHrpCyxyqABQnzw%40mail.gmail.com
> .
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/CAOXm%2Bp8tF1Zpt1gmFH%3DTc6fin3ijf%2B3kDrc9j_yRR2ZBbxVfSA%40mail.gmail.com
> .
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAJwZndefeU5b4a9J_JjyMpTHyr-dwQ5GCs-7eJf0Kvf3qdjUFQ%40mail.gmail.com.


Re: hello guys, how can I upload multiple images using single button? help me please

2021-01-09 Thread Joseph Wayodi
The Django docs show how to do this:
.

On Thu, 7 Jan 2021 at 15:24, Chelsea Fan  wrote:
>
>
> --
> You received this message because you are subscribed to the Google Groups 
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to django-users+unsubscr...@googlegroups.com.
> To view this discussion on the web visit 
> https://groups.google.com/d/msgid/django-users/CAJwZndca8SC7ifBzyW4ut%3DJXy-2E3RPPvq2tHrpCyxyqABQnzw%40mail.gmail.com.

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAOXm%2Bp8tF1Zpt1gmFH%3DTc6fin3ijf%2B3kDrc9j_yRR2ZBbxVfSA%40mail.gmail.com.


Re: hello guys, how can I upload multiple images using single button? help me please

2021-01-08 Thread Chelsea Fan
server rendering

On Fri, Jan 8, 2021 at 5:23 PM Satyajit Barik 
wrote:

> do you use API or server side rendering method?
>
> On Fri, Jan 8, 2021 at 1:34 PM Chelsea Fan 
> wrote:
>
>> yes I am using FileField and trying upload and to save it
>>
>>
>> On Thu, Jan 7, 2021 at 4:09 PM Steven Mapes 
>> wrote:
>>
>>> Within Django Admin or somewhere else?
>>> Are you using FileFields and trying to save to the models or are you
>>> just trying to POST multiple files?
>>>
>>> On Thursday, 7 January 2021 at 12:25:10 UTC allaberdi...@gmail.com
>>> wrote:
>>>
 --
>>> You received this message because you are subscribed to the Google
>>> Groups "Django users" group.
>>> To unsubscribe from this group and stop receiving emails from it, send
>>> an email to django-users+unsubscr...@googlegroups.com.
>>> To view this discussion on the web visit
>>> https://groups.google.com/d/msgid/django-users/ba3a4c6a-0788-457f-8e7d-576d612a7f61n%40googlegroups.com
>>> 
>>> .
>>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "Django users" group.
>> To unsubscribe from this group and stop receiving emails from it, send an
>> email to django-users+unsubscr...@googlegroups.com.
>> To view this discussion on the web visit
>> https://groups.google.com/d/msgid/django-users/CAJwZnde38EREC%3DhrYAfGLP4QKvPD-OwC_aJb6W1-o1n6GTDrBg%40mail.gmail.com
>> 
>> .
>>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/CANd-%2BoCvYOnwxPj7rM5kdZWQtERSufab7jTwgBxqgbD2-j0%2BVw%40mail.gmail.com
> 
> .
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAJwZndfoNtZbsHrqvy7R1tG2Q8mwK8BtCushL2b_5M0c%2B%3DMTng%40mail.gmail.com.


Re: hello guys, how can I upload multiple images using single button? help me please

2021-01-08 Thread Satyajit Barik
do you use API or server side rendering method?

On Fri, Jan 8, 2021 at 1:34 PM Chelsea Fan 
wrote:

> yes I am using FileField and trying upload and to save it
>
>
> On Thu, Jan 7, 2021 at 4:09 PM Steven Mapes 
> wrote:
>
>> Within Django Admin or somewhere else?
>> Are you using FileFields and trying to save to the models or are you just
>> trying to POST multiple files?
>>
>> On Thursday, 7 January 2021 at 12:25:10 UTC allaberdi...@gmail.com wrote:
>>
>>> --
>> You received this message because you are subscribed to the Google Groups
>> "Django users" group.
>> To unsubscribe from this group and stop receiving emails from it, send an
>> email to django-users+unsubscr...@googlegroups.com.
>> To view this discussion on the web visit
>> https://groups.google.com/d/msgid/django-users/ba3a4c6a-0788-457f-8e7d-576d612a7f61n%40googlegroups.com
>> 
>> .
>>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/CAJwZnde38EREC%3DhrYAfGLP4QKvPD-OwC_aJb6W1-o1n6GTDrBg%40mail.gmail.com
> 
> .
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CANd-%2BoCvYOnwxPj7rM5kdZWQtERSufab7jTwgBxqgbD2-j0%2BVw%40mail.gmail.com.


Re: hello guys, how can I upload multiple images using single button? help me please

2021-01-08 Thread Chelsea Fan
yes I am using FileField and trying upload and to save it


On Thu, Jan 7, 2021 at 4:09 PM Steven Mapes  wrote:

> Within Django Admin or somewhere else?
> Are you using FileFields and trying to save to the models or are you just
> trying to POST multiple files?
>
> On Thursday, 7 January 2021 at 12:25:10 UTC allaberdi...@gmail.com wrote:
>
>> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/ba3a4c6a-0788-457f-8e7d-576d612a7f61n%40googlegroups.com
> 
> .
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAJwZnde38EREC%3DhrYAfGLP4QKvPD-OwC_aJb6W1-o1n6GTDrBg%40mail.gmail.com.


Re: hello guys, how can I upload multiple images using single button? help me please

2021-01-07 Thread Steven Mapes
Within Django Admin or somewhere else?
Are you using FileFields and trying to save to the models or are you just 
trying to POST multiple files?

On Thursday, 7 January 2021 at 12:25:10 UTC allaberdi...@gmail.com wrote:

>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/ba3a4c6a-0788-457f-8e7d-576d612a7f61n%40googlegroups.com.


hello guys, how can I upload multiple images using single button? help me please

2021-01-07 Thread Chelsea Fan


-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAJwZndca8SC7ifBzyW4ut%3DJXy-2E3RPPvq2tHrpCyxyqABQnzw%40mail.gmail.com.


Re: Pasting images versus uploading

2020-10-16 Thread Mike Dewhirst

RyanThank you for that research and advice. I need to follow through and absorb 
the implications. That means trying both and then deciding. I'll report in due 
course.Thanks to allMike--(Unsigned mail from my phone)
 Original message From: Ryan Nowakowski  
Date: 15/10/20  09:28  (GMT+10:00) To: django-users@googlegroups.com Subject: 
Re: Pasting images versus uploading On Fri, Oct 09, 2020 at 06:22:10PM +1100, 
Mike Dewhirst wrote:> On 9/10/2020 11:55 am, Ryan Nowakowski wrote:> > Maybe 
you could swap out the default ImageField widget for> > TinyMCE-lite HTMLField? 
Security-wise you probably want to sanitize> > the input from HTMLField in 
Django to make sure only img tags are allowed.> > With the image pasted in, 
viewing the browser page source it is> represented as just a string although it 
does contain ...> > ... src=data:image/png;base64,iVBOR ...> > > Are you 
saying all I have to do is write a clean() method for the> HTMLField to detect 
various image types?In your Django form class I'd write a clean method 
specifically for thatfield[1] that parses the html, perhaps using 
BeautifulSoup[2].  Thensearch for any "img" tags.  For each img tag, parse the 
data URI[3] toget the image data.You still have the problem that the HTMLField 
is meant to be areplacement for TextField so you'll need to figure out how to 
back thatwith an ImageField instead.  Perhaps you should try to go one 
levellower and use the TinyMCE form widget[4] instead of using the 
HTMLField?[1] 
https://docs.djangoproject.com/en/3.1/ref/forms/validation/#cleaning-a-specific-field-attribute[2]
 https://www.crummy.com/software/BeautifulSoup/bs4/doc/[3] 
https://stackoverflow.com/a/33870677/226697[4] 
http://romanvm.github.io/django-tinymce4-lite/usage.html#tinymce-widget-for-forms--
 You received this message because you are subscribed to the Google Groups 
"Django users" group.To unsubscribe from this group and stop receiving emails 
from it, send an email to django-users+unsubscr...@googlegroups.com.to view 
this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/20201014222827.GW12495%40fattuba.com.

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/5f8a2b78.1c69fb81.74a25.3aa4SMTPIN_ADDED_MISSING%40gmr-mx.google.com.


Re: Pasting images versus uploading

2020-10-14 Thread Ryan Nowakowski
On Fri, Oct 09, 2020 at 06:22:10PM +1100, Mike Dewhirst wrote:
> On 9/10/2020 11:55 am, Ryan Nowakowski wrote:
> > Maybe you could swap out the default ImageField widget for
> > TinyMCE-lite HTMLField? Security-wise you probably want to sanitize
> > the input from HTMLField in Django to make sure only img tags are allowed.
> 
> With the image pasted in, viewing the browser page source it is
> represented as just a string although it does contain ...
> 
> ... src=data:image/png;base64,iVBOR ...
> 
> 
> Are you saying all I have to do is write a clean() method for the
> HTMLField to detect various image types?

In your Django form class I'd write a clean method specifically for that
field[1] that parses the html, perhaps using BeautifulSoup[2].  Then
search for any "img" tags.  For each img tag, parse the data URI[3] to
get the image data.

You still have the problem that the HTMLField is meant to be a
replacement for TextField so you'll need to figure out how to back that
with an ImageField instead.  Perhaps you should try to go one level
lower and use the TinyMCE form widget[4] instead of using the HTMLField?

[1] 
https://docs.djangoproject.com/en/3.1/ref/forms/validation/#cleaning-a-specific-field-attribute
[2] https://www.crummy.com/software/BeautifulSoup/bs4/doc/
[3] https://stackoverflow.com/a/33870677/226697
[4] 
http://romanvm.github.io/django-tinymce4-lite/usage.html#tinymce-widget-for-forms

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/20201014222827.GW12495%40fattuba.com.


Re: Pasting images versus uploading

2020-10-11 Thread Dvs Khamele
Hi do you hire contract based python/django freelancer?
 We can help you in this and related tasks at fair prices. Reply or send
email to divy...@pythonmate.com
Best Regards,
Divyesh Khamele,
Pythonmate

On Fri, 9 Oct 2020, 12:53 pm Mike Dewhirst,  wrote:

> On 9/10/2020 11:55 am, Ryan Nowakowski wrote:
> > Maybe you could swap out the default ImageField widget for
> > TinyMCE-lite HTMLField? Security-wise you probably want to sanitize
> > the input from HTMLField in Django to make sure only img tags are
> allowed.
>
> With the image pasted in, viewing the browser page source it is
> represented as just a string although it does contain ...
>
> ... src=data:image/png;base64,iVBOR ...
>
>
> Are you saying all I have to do is write a clean() method for the
> HTMLField to detect various image types?
>
> Thanks
>
> Mike
>
> >
> > On October 7, 2020 7:02:16 PM CDT, Mike Dewhirst
> >  wrote:
> >
> > Users need to include an image of a molecular structure in a project I'm
> > building. These are small enough that I could limit the size without
> > restricting functionality. The image needs to be printed out for a
> report.
> >
> > What is the best approach?
> >
> > I have implemented a TinyMCE-lite HTMLField which accepts a pasted image
> > and in other systems I have used a Django ImageField for uploading.
> > ImageField is obviously easier on database size but pasting is easier on
> > the users.
> >
> > I'm keen to make the UI easier (by pasting) but I worry it is a
> > vulnerability if abused.
> >
> > Thanks for any advice
> >
> > Cheers
> >
> > Mike
> >
> > -- You received this message because you are subscribed to the Google
> > Groups "Django users" group.
> > To unsubscribe from this group and stop receiving emails from it, send
> > an email to django-users+unsubscr...@googlegroups.com
> > .
> > To view this discussion on the web visit
> >
> https://groups.google.com/d/msgid/django-users/0F5DF089-E571-4730-9D46-7DD41216F4D4%40fattuba.com
> > <
> https://groups.google.com/d/msgid/django-users/0F5DF089-E571-4730-9D46-7DD41216F4D4%40fattuba.com?utm_medium=email_source=footer
> >.
>
>
> --
> Signed email is an absolute defence against phishing. This email has
> been signed with my private key. If you import my public key you can
> automatically decrypt my signature and be sure it came from me. Just
> ask and I'll send it to you. Your email software can handle signing.
>
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/3611cc83-8ce8-5ccc-5f15-1463da733e26%40dewhirst.com.au
> .
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAH9mneWGMKGEGdKT%2BqX1KHLTqw-wNq2yY3DeQr0x9xUiBJ%3DfxA%40mail.gmail.com.


Re: Pasting images versus uploading

2020-10-09 Thread Mike Dewhirst
On 9/10/2020 11:55 am, Ryan Nowakowski wrote:
> Maybe you could swap out the default ImageField widget for
> TinyMCE-lite HTMLField? Security-wise you probably want to sanitize
> the input from HTMLField in Django to make sure only img tags are allowed.

With the image pasted in, viewing the browser page source it is
represented as just a string although it does contain ...

... src=data:image/png;base64,iVBOR ...


Are you saying all I have to do is write a clean() method for the
HTMLField to detect various image types?

Thanks

Mike

>
> On October 7, 2020 7:02:16 PM CDT, Mike Dewhirst
>  wrote:
>
> Users need to include an image of a molecular structure in a project I'm
> building. These are small enough that I could limit the size without
> restricting functionality. The image needs to be printed out for a report.
>
> What is the best approach?
>
> I have implemented a TinyMCE-lite HTMLField which accepts a pasted image
> and in other systems I have used a Django ImageField for uploading.
> ImageField is obviously easier on database size but pasting is easier on
> the users.
>
> I'm keen to make the UI easier (by pasting) but I worry it is a
> vulnerability if abused.
>
> Thanks for any advice
>
> Cheers
>
> Mike
>
> -- You received this message because you are subscribed to the Google
> Groups "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send
> an email to django-users+unsubscr...@googlegroups.com
> .
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/0F5DF089-E571-4730-9D46-7DD41216F4D4%40fattuba.com
> .


-- 
Signed email is an absolute defence against phishing. This email has
been signed with my private key. If you import my public key you can
automatically decrypt my signature and be sure it came from me. Just
ask and I'll send it to you. Your email software can handle signing.


-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/3611cc83-8ce8-5ccc-5f15-1463da733e26%40dewhirst.com.au.


signature.asc
Description: OpenPGP digital signature


Re: Pasting images versus uploading

2020-10-08 Thread Ryan Nowakowski
Maybe you could swap out the default ImageField widget for TinyMCE-lite 
HTMLField?  Security-wise you probably want to sanitize the input from 
HTMLField in Django to make sure only img tags are allowed.

On October 7, 2020 7:02:16 PM CDT, Mike Dewhirst  wrote:
>Users need to include an image of a molecular structure in a project
>I'm
>building. These are small enough that I could limit the size without
>restricting functionality. The image needs to be printed out for a
>report.
>
>What is the best approach?
>
>I have implemented a TinyMCE-lite HTMLField which accepts a pasted
>image
>and in other systems I have used a Django ImageField for uploading.
>ImageField is obviously easier on database size but pasting is easier
>on
>the users.
>
>I'm keen to make the UI easier (by pasting) but I worry it is a
>vulnerability if abused.
>
>Thanks for any advice
>
>Cheers
>
>Mike
>
>-- 
>You received this message because you are subscribed to the Google
>Groups "Django users" group.
>To unsubscribe from this group and stop receiving emails from it, send
>an email to django-users+unsubscr...@googlegroups.com.
>To view this discussion on the web visit
>https://groups.google.com/d/msgid/django-users/6df3667e-f9cf-eab2-acab-b3e415af1969%40dewhirst.com.au.

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/0F5DF089-E571-4730-9D46-7DD41216F4D4%40fattuba.com.


Pasting images versus uploading

2020-10-07 Thread Mike Dewhirst
Users need to include an image of a molecular structure in a project I'm
building. These are small enough that I could limit the size without
restricting functionality. The image needs to be printed out for a report.

What is the best approach?

I have implemented a TinyMCE-lite HTMLField which accepts a pasted image
and in other systems I have used a Django ImageField for uploading.
ImageField is obviously easier on database size but pasting is easier on
the users.

I'm keen to make the UI easier (by pasting) but I worry it is a
vulnerability if abused.

Thanks for any advice

Cheers

Mike

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/6df3667e-f9cf-eab2-acab-b3e415af1969%40dewhirst.com.au.


Re: guys help me please, I cannot upload images from django form,

2020-08-29 Thread Chelsea Fan
ok bro I'll try it, thanks for now

On Sat, Aug 29, 2020 at 7:53 PM Jonathan Villavicencio <
codejonvi...@gmail.com> wrote:

> Hello!
> in the class Posts in the field "image" add upload_to=upload_path for
> example:
> image = models.ImageField(blank=True, null=True, verbose_name='surat',
> upload_to=upload_path)
>
> upload_path is a method
> write it before of the class definition
> def upload_path(instance, filename):
> return '/'.join([instance.image, filename])
>
> El sáb., 29 de ago. de 2020 a la(s) 11:16, allaberdi...@gmail.com (
> allaberdi16yazha...@gmail.com) escribió:
>
>> I can upload images from django admin panel but cannot to do same thing
>> with django form ,  it saves any text but did not save images only,  anyone
>> help me  please
>> this is my code:
>>
>> models.py:
>> class Posts(models.Model):
>>
>> Ahal = 'Ahal'
>> Balkan = 'Balkan'
>> Dasoguz = 'Dasoguz'
>> Lebap = 'Lebap'
>> Mary = 'Mary'
>>
>>
>> CHOOSE_REGION = {
>> (Ahal,'Ahal'),
>> (Balkan,'Balkan'),
>> (Dasoguz,'Dasoguz'),
>> (Lebap,'Lebap'),
>> (Mary,'Mary')
>> }
>>
>>
>> name = models.CharField(max_length=30, blank=False, verbose_name='Ady')
>> image = models.ImageField(blank=True, null=True, verbose_name='surat')
>> text = models.TextField(verbose_name='gosmaça maglumat')
>> price = models.FloatField(verbose_name='bahasy')
>> region = models.CharField(max_length=30, choices=CHOOSE_REGION,
>> blank=False, verbose_name='welaýat')
>> district = models.CharField(max_length=30, blank=False,
>> verbose_name='etrab')
>> user = models.ForeignKey(User, on_delete=models.CASCADE,
>> verbose_name='eýesi')
>> phone = models.CharField(max_length=50, blank=False,
>> verbose_name='telefon belgisi')
>> published = models.DateTimeField(auto_now=True, verbose_name='satuwa
>> çykan guni')
>>
>>
>>
>> forms.py:
>> class PostForm(forms.ModelForm):
>> class Meta:
>> model = Posts
>> fields =
>> ['name','image','text','price','region','district','user','phone']
>>
>>
>> views.py:
>> def add_post(request):
>> form = PostForm(request.POST or None)
>> if form.is_valid():
>> form.save()
>> template = 'add_post.html'
>> context = {'form':form}
>> return render(request,template,context)
>>
>> settings.py:
>>
>> STATIC_URL = '/static/'
>> STATICFILES_DIR = [Path(BASE_DIR,'static')]
>>
>> MEDIA_URL = '/media/'
>> MEDIA_ROOT = Path(BASE_DIR,'media')
>>
>>
>> urls.py:
>>
>> from django.conf.urls.static import static
>> from django.conf import settings
>>
>> urlpatterns = [
>> path('admin/', admin.site.urls),
>> path('', include('posts.urls')),
>> ]
>>
>> urlpatterns += static(settings.MEDIA_URL,
>> document_root=settings.MEDIA_ROOT)
>>
>>
>>
>> html form tag:
>> {% extends 'index.html' %}
>>
>> {% load static %}
>>
>> {% block content %}
>>
>> 
>> {% csrf_token %}
>> {{form.media}}
>> {{form.as_p}}
>> 
>> 
>>
>> {% endblock %}
>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "Django users" group.
>> To unsubscribe from this group and stop receiving emails from it, send an
>> email to django-users+unsubscr...@googlegroups.com.
>> To view this discussion on the web visit
>> https://groups.google.com/d/msgid/django-users/ad47578f-64a8-40b5-b72b-f3eebb668dben%40googlegroups.com
>> <https://groups.google.com/d/msgid/django-users/ad47578f-64a8-40b5-b72b-f3eebb668dben%40googlegroups.com?utm_medium=email_source=footer>
>> .
>>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/CAAEkprV7PmRfkHyMD4VS%3DiN6S%2BjGUwaoaWrkxQ2fhWWXOoHc9Q%40mail.gmail.com
> <https://groups.google.com/d/msgid/django-users/CAAEkprV7PmRfkHyMD4VS%3DiN6S%2BjGUwaoaWrkxQ2fhWWXOoHc9Q%40mail.gmail.com?utm_medium=email_source=footer>
> .
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAJwZnddD5EHO%3DLADx-wGF3s_HopVOi31Wqjot3UgbSspUR-9yw%40mail.gmail.com.


Re: guys help me please, I cannot upload images from django form,

2020-08-29 Thread Jonathan Villavicencio
Hello!
in the class Posts in the field "image" add upload_to=upload_path for
example:
image = models.ImageField(blank=True, null=True, verbose_name='surat',
upload_to=upload_path)

upload_path is a method
write it before of the class definition
def upload_path(instance, filename):
return '/'.join([instance.image, filename])

El sáb., 29 de ago. de 2020 a la(s) 11:16, allaberdi...@gmail.com (
allaberdi16yazha...@gmail.com) escribió:

> I can upload images from django admin panel but cannot to do same thing
> with django form ,  it saves any text but did not save images only,  anyone
> help me  please
> this is my code:
>
> models.py:
> class Posts(models.Model):
>
> Ahal = 'Ahal'
> Balkan = 'Balkan'
> Dasoguz = 'Dasoguz'
> Lebap = 'Lebap'
> Mary = 'Mary'
>
>
> CHOOSE_REGION = {
> (Ahal,'Ahal'),
> (Balkan,'Balkan'),
> (Dasoguz,'Dasoguz'),
> (Lebap,'Lebap'),
> (Mary,'Mary')
> }
>
>
> name = models.CharField(max_length=30, blank=False, verbose_name='Ady')
> image = models.ImageField(blank=True, null=True, verbose_name='surat')
> text = models.TextField(verbose_name='gosmaça maglumat')
> price = models.FloatField(verbose_name='bahasy')
> region = models.CharField(max_length=30, choices=CHOOSE_REGION,
> blank=False, verbose_name='welaýat')
> district = models.CharField(max_length=30, blank=False,
> verbose_name='etrab')
> user = models.ForeignKey(User, on_delete=models.CASCADE,
> verbose_name='eýesi')
> phone = models.CharField(max_length=50, blank=False, verbose_name='telefon
> belgisi')
> published = models.DateTimeField(auto_now=True, verbose_name='satuwa çykan
> guni')
>
>
>
> forms.py:
> class PostForm(forms.ModelForm):
> class Meta:
> model = Posts
> fields = ['name','image','text','price','region','district','user','phone']
>
>
> views.py:
> def add_post(request):
> form = PostForm(request.POST or None)
> if form.is_valid():
> form.save()
> template = 'add_post.html'
> context = {'form':form}
> return render(request,template,context)
>
> settings.py:
>
> STATIC_URL = '/static/'
> STATICFILES_DIR = [Path(BASE_DIR,'static')]
>
> MEDIA_URL = '/media/'
> MEDIA_ROOT = Path(BASE_DIR,'media')
>
>
> urls.py:
>
> from django.conf.urls.static import static
> from django.conf import settings
>
> urlpatterns = [
> path('admin/', admin.site.urls),
> path('', include('posts.urls')),
> ]
>
> urlpatterns += static(settings.MEDIA_URL,
> document_root=settings.MEDIA_ROOT)
>
>
>
> html form tag:
> {% extends 'index.html' %}
>
> {% load static %}
>
> {% block content %}
>
> 
> {% csrf_token %}
> {{form.media}}
> {{form.as_p}}
> 
> 
>
> {% endblock %}
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/ad47578f-64a8-40b5-b72b-f3eebb668dben%40googlegroups.com
> <https://groups.google.com/d/msgid/django-users/ad47578f-64a8-40b5-b72b-f3eebb668dben%40googlegroups.com?utm_medium=email_source=footer>
> .
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAAEkprV7PmRfkHyMD4VS%3DiN6S%2BjGUwaoaWrkxQ2fhWWXOoHc9Q%40mail.gmail.com.


guys help me please, I cannot upload images from django form,

2020-08-29 Thread allaberdi...@gmail.com
I can upload images from django admin panel but cannot to do same thing 
with django form ,  it saves any text but did not save images only,  anyone 
help me  please 
this is my code:

models.py:
class Posts(models.Model):

Ahal = 'Ahal'
Balkan = 'Balkan'
Dasoguz = 'Dasoguz'
Lebap = 'Lebap'
Mary = 'Mary'


CHOOSE_REGION = {
(Ahal,'Ahal'),
(Balkan,'Balkan'),
(Dasoguz,'Dasoguz'),
(Lebap,'Lebap'),
(Mary,'Mary')
} 


name = models.CharField(max_length=30, blank=False, verbose_name='Ady')
image = models.ImageField(blank=True, null=True, verbose_name='surat')
text = models.TextField(verbose_name='gosmaça maglumat')
price = models.FloatField(verbose_name='bahasy')
region = models.CharField(max_length=30, choices=CHOOSE_REGION, 
blank=False, verbose_name='welaýat')
district = models.CharField(max_length=30, blank=False, 
verbose_name='etrab')
user = models.ForeignKey(User, on_delete=models.CASCADE, 
verbose_name='eýesi')
phone = models.CharField(max_length=50, blank=False, verbose_name='telefon 
belgisi')
published = models.DateTimeField(auto_now=True, verbose_name='satuwa çykan 
guni')



forms.py:
class PostForm(forms.ModelForm):
class Meta:
model = Posts
fields = ['name','image','text','price','region','district','user','phone']


views.py:
def add_post(request):
form = PostForm(request.POST or None)
if form.is_valid():
form.save()
template = 'add_post.html'
context = {'form':form}
return render(request,template,context)

settings.py:

STATIC_URL = '/static/'
STATICFILES_DIR = [Path(BASE_DIR,'static')]

MEDIA_URL = '/media/'
MEDIA_ROOT = Path(BASE_DIR,'media')


urls.py:

from django.conf.urls.static import static
from django.conf import settings

urlpatterns = [
path('admin/', admin.site.urls),
path('', include('posts.urls')),
] 

urlpatterns += static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)



html form tag:
{% extends 'index.html' %}

{% load static %}

{% block content %}


{% csrf_token %}
{{form.media}}
{{form.as_p}}
 


{% endblock %}

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/ad47578f-64a8-40b5-b72b-f3eebb668dben%40googlegroups.com.


Re: How to save images posted by application users

2020-07-18 Thread Liu Zheng
Hi. Here's a very nice video tutorial on how to handle images with media. 
https://www.youtube.com/watch?v=FdVuKt_iuSI=PL-osiE80TeTtoQCKZ03TU5fNfx2UY6U4p=8

Also to your question on how to deploy it in production, check this video. 
https://www.youtube.com/watch?v=Sa_kQheCnds=PL-osiE80TeTtoQCKZ03TU5fNfx2UY6U4p=13

On Thursday, July 16, 2020 at 1:08:08 PM UTC+8, Ram wrote:
>
> Hi,
>
> We need to save images posted by our application users and the images will 
> be displayed in application UI once they are saved successfully. We are 
> trying with these parameters in our settings.py but they are not working 
> and our OS platform is Windows 10 OS. We know file paths are different in 
> Windows OS when compared to non Windows OS platforms. Did anyone use Window 
> OS in this community and able to save image successfully?
>
> STATIC_ROOT = os.path.join(BASE_DIR, 'staticfiles')
>> STATIC_URL = '/static/'
>>
>>
>> MEDIA_ROOT = os.path.join(BASE_DIR, 'media')
>> MEDIA_URL = '/media/'
>>
>>
> Another challenge that we have is  that the above question is related to 
> development, becase we use Windows laptop for our application evelopment, 
> but once the code is integrated we need to deploy the code in our hosting 
> server that is running with Linux OS. So we are not sure how to handle the 
> case of multi OS platforms?
>
> I'm sure many people could have resolved this in their applications. I 
> appreciate if you can share suitabe recommendations?
>
> Best regards
>  
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/8ee01fd9-7d32-4bfc-89da-d057df415fcfo%40googlegroups.com.


Re: How to save images posted by application users

2020-07-17 Thread Mottaz Hegaze
Try to use subfolder in media, upload_to='/images'



On Fri, 17 Jul 2020, 7:18 am Exactly musty, 
wrote:

> I also had the same problem long time ago I remember i felt like hanging
> myself,here is what I did, i deleted the media folder,created by django,
> try this if it will work
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/c3d661dd-7cf3-4ff7-9332-422687927a29o%40googlegroups.com
> .
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAHV4E-cFYn-NfZ%3D8N6hiGBERXZU1Fxe4ZO236qgWzTAesJNzNA%40mail.gmail.com.


Re: How to save images posted by application users

2020-07-16 Thread Exactly musty
I also had the same problem long time ago I remember i felt like hanging 
myself,here is what I did, i deleted the media folder,created by django, try 
this if it will work 

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/c3d661dd-7cf3-4ff7-9332-422687927a29o%40googlegroups.com.


Re: How to save images posted by application users

2020-07-16 Thread Ram
Hi Mottaz,

Thank you for your suggestion. We already tried a model with ImageField but
not luck yet. Here is our code snippet

image = models.ImageField(upload_to='media',
> null=True, blank=True) image2 = models.ImageField(upload_to='media',
> null=True, blank=True) image3 = models.ImageField(upload_to='media',
> null=True, blank=True)
>

settings.py has the related settings

STATIC_ROOT = os.path.join(BASE_DIR, 'staticfiles')
> STATIC_URL = '/static/'
>
> MEDIA_ROOT = os.path.join(BASE_DIR, 'media')
> MEDIA_URL = '/media/'
>
> and also we have urls patterns like this in urls.py

>
> from django.contrib.staticfiles.urls import static
>> from django.contrib.staticfiles.urls import staticfiles_urlpatterns
>> 
>> 
>>
> if settings.DEBUG is True:
>  urlpatterns += static(settings.MEDIA_URL,
> document_root=settings.MEDIA_ROOT)
>

 ran the following commands after the above changes

1. makemigrations
2. migrate
3. collectstatic
4. runserver

Then we posted an Ad in front end of the application with images and we
getting this error and images did not show up in front end,

>
> Not Found: /media/jpg1.jpg
>>>
>> [17/Jul/2020 10:27:27] "GET /media/bluejpg.jpg HTTP/1.1" 404 1816
>> [17/Jul/2020 10:27:27] "GET /media/jpg1.jpg HTTP/1.1" 404 1807
>>
> [17/Jul/2020 10:27:27] "GET /static/css/images/notice.png HTTP/1.1" 404
> 1689
>

 Thanks,
~Ram


On Thu, Jul 16, 2020 at 1:18 AM Mottaz Hegaze  wrote:

> You need a model with ImageField or FileField
>
> On Thu, 16 Jul 2020, 7:07 am Ram,  wrote:
>
>> Hi,
>>
>> We need to save images posted by our application users and the images
>> will be displayed in application UI once they are saved successfully. We
>> are trying with these parameters in our settings.py but they are not
>> working and our OS platform is Windows 10 OS. We know file paths are
>> different in Windows OS when compared to non Windows OS platforms. Did
>> anyone use Window OS in this community and able to save image successfully?
>>
>> STATIC_ROOT = os.path.join(BASE_DIR, 'staticfiles')
>>> STATIC_URL = '/static/'
>>>
>>>
>>> MEDIA_ROOT = os.path.join(BASE_DIR, 'media')
>>> MEDIA_URL = '/media/'
>>>
>>>
>> Another challenge that we have is  that the above question is related to
>> development, becase we use Windows laptop for our application evelopment,
>> but once the code is integrated we need to deploy the code in our hosting
>> server that is running with Linux OS. So we are not sure how to handle the
>> case of multi OS platforms?
>>
>> I'm sure many people could have resolved this in their applications. I
>> appreciate if you can share suitabe recommendations?
>>
>> Best regards
>>
>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "Django users" group.
>> To unsubscribe from this group and stop receiving emails from it, send an
>> email to django-users+unsubscr...@googlegroups.com.
>> To view this discussion on the web visit
>> https://groups.google.com/d/msgid/django-users/CA%2BOi5F095b3_rr2qv02qrneLKs%2BySO1AjXedUv%3D653LY3cfDnw%40mail.gmail.com
>> <https://groups.google.com/d/msgid/django-users/CA%2BOi5F095b3_rr2qv02qrneLKs%2BySO1AjXedUv%3D653LY3cfDnw%40mail.gmail.com?utm_medium=email_source=footer>
>> .
>>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/CAHV4E-cqB-S5xtKVQA1QyMCqoyZ0F6OHT%3DOPM034-iJ4OnmBEg%40mail.gmail.com
> <https://groups.google.com/d/msgid/django-users/CAHV4E-cqB-S5xtKVQA1QyMCqoyZ0F6OHT%3DOPM034-iJ4OnmBEg%40mail.gmail.com?utm_medium=email_source=footer>
> .
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CA%2BOi5F0WofNvcTr8DrOAEv7UY_XJ6sU90LqcGfD6hdBmMFbjqQ%40mail.gmail.com.


Re: How to save images posted by application users

2020-07-16 Thread Mottaz Hegaze
You need a model with ImageField or FileField

On Thu, 16 Jul 2020, 7:07 am Ram,  wrote:

> Hi,
>
> We need to save images posted by our application users and the images will
> be displayed in application UI once they are saved successfully. We are
> trying with these parameters in our settings.py but they are not working
> and our OS platform is Windows 10 OS. We know file paths are different in
> Windows OS when compared to non Windows OS platforms. Did anyone use Window
> OS in this community and able to save image successfully?
>
> STATIC_ROOT = os.path.join(BASE_DIR, 'staticfiles')
>> STATIC_URL = '/static/'
>>
>>
>> MEDIA_ROOT = os.path.join(BASE_DIR, 'media')
>> MEDIA_URL = '/media/'
>>
>>
> Another challenge that we have is  that the above question is related to
> development, becase we use Windows laptop for our application evelopment,
> but once the code is integrated we need to deploy the code in our hosting
> server that is running with Linux OS. So we are not sure how to handle the
> case of multi OS platforms?
>
> I'm sure many people could have resolved this in their applications. I
> appreciate if you can share suitabe recommendations?
>
> Best regards
>
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/CA%2BOi5F095b3_rr2qv02qrneLKs%2BySO1AjXedUv%3D653LY3cfDnw%40mail.gmail.com
> <https://groups.google.com/d/msgid/django-users/CA%2BOi5F095b3_rr2qv02qrneLKs%2BySO1AjXedUv%3D653LY3cfDnw%40mail.gmail.com?utm_medium=email_source=footer>
> .
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAHV4E-cqB-S5xtKVQA1QyMCqoyZ0F6OHT%3DOPM034-iJ4OnmBEg%40mail.gmail.com.


How to save images posted by application users

2020-07-15 Thread Ram
Hi,

We need to save images posted by our application users and the images will
be displayed in application UI once they are saved successfully. We are
trying with these parameters in our settings.py but they are not working
and our OS platform is Windows 10 OS. We know file paths are different in
Windows OS when compared to non Windows OS platforms. Did anyone use Window
OS in this community and able to save image successfully?

STATIC_ROOT = os.path.join(BASE_DIR, 'staticfiles')
> STATIC_URL = '/static/'
>
>
> MEDIA_ROOT = os.path.join(BASE_DIR, 'media')
> MEDIA_URL = '/media/'
>
>
Another challenge that we have is  that the above question is related to
development, becase we use Windows laptop for our application evelopment,
but once the code is integrated we need to deploy the code in our hosting
server that is running with Linux OS. So we are not sure how to handle the
case of multi OS platforms?

I'm sure many people could have resolved this in their applications. I
appreciate if you can share suitabe recommendations?

Best regards

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CA%2BOi5F095b3_rr2qv02qrneLKs%2BySO1AjXedUv%3D653LY3cfDnw%40mail.gmail.com.


Re: How to get data from django model to excel sheet using openpyxl including images.

2020-07-10 Thread VenkataSivaRamiReddy
Hi man,

Have you tried *xlsxwditer* package.

If not please check

On Fri, Jul 10, 2020, 19:23 Ashutosh Mishra 
wrote:

> I am doing that using openpyxl
> But not getting the image in excel sheet
>
>
> https://stackoverflow.com/questions/62695531/cannot-convert-fieldfile-jpg-to-excel-django
>
> See this
>
> On Fri, Jul 10, 2020, 7:15 PM Vishesh Mangla 
> wrote:
>
>> Api’s are better suited for Django rest framework.
>>
>>
>>
>> Sent from Mail <https://go.microsoft.com/fwlink/?LinkId=550986> for
>> Windows 10
>>
>>
>>
>> *From: *Ashutosh Mishra 
>> *Sent: *10 July 2020 18:30
>> *To: *Django users 
>> *Subject: *Re: How to get data from django model to excel sheet using
>> openpyxl including images.
>>
>>
>>
>> i have created an api through which i can download the excel file with
>> all fields except images.I am posting my models and views
>>
>>
>>
>> models.py
>>
>>
>>
>> class Task(models.Model):
>>
>>
>>
>> Id=models.IntegerField()
>>
>> Name=models.CharField(max_length=50,null=False,blank=True)
>>
>> Image1=models.FileField(blank=True, default="",
>>
>> upload_to="media/images",null=True)
>>
>> Image2=models.FileField(blank=True, default="",
>>
>> upload_to="media/images",null=True)
>>
>> Date=models.DateField(null=True,blank=True)
>>
>> def __str__(self):
>>
>> return str(self.Name)
>>
>>
>>
>> views.py
>>
>> class TaskViewSet(viewsets.ViewSet):
>>
>>
>>
>> def list(self,request):
>>
>> try:
>>
>> queryset=Task.objects.all()
>>
>> response = HttpResponse(content_type='application/ms-excel')
>>
>> #response=HttpResponse(content_type='application/ms-excel')
>>
>>
>>
>> #response['Content-Disposition'] = 'attachment; filename="users.xls'
>>
>> response['Content-Disposition']='attachment; filename="users.xls"'
>>
>>
>>
>> wb=openpyxl.Workbook()
>>
>> ws=wb.active
>>
>>
>>
>> row_num=0
>>
>> columns=['Id','Name','Image1','Image2','Date']
>>
>>
>>
>> for col_num in range(len(columns)):
>>
>> c = ws.cell(row=row_num + 1, column=col_num + 1)
>>
>> c.value = columns[col_num]
>>
>> for obj in queryset:
>>
>> row_num+=1
>>
>> row = [
>>
>> obj.Id,
>>
>> obj.Name,
>>
>> obj.Image1.url,
>>
>> obj.Image2.url,
>>
>> str(obj.Date),
>>
>> ]
>>
>> print(type(row))
>>
>>
>>
>> for col_num in range(len(row)):
>>
>> c = ws.cell(row=row_num + 1, column=col_num + 1)
>>
>> c.value = row[col_num]
>>
>>
>>
>> wb.save(response)
>>
>> return response
>>
>> except Exception as error:
>>
>> traceback.print_exc()
>>
>> return Response({"message": str(error), "success": False},
>> status=status.HTTP_200_OK)
>>
>>
>>
>>
>>
>> On Friday, July 10, 2020 at 5:48:36 PM UTC+5:30 ajoeiam wrote:
>>
>> On Thu, Jul 9, 2020 at 10:02 PM Ashutosh Mishra 
>> wrote:
>>
>> I am creating an api to get data and images from django model to excel
>> sheet ,how can i do that,someone please help me.
>>
>>
>>
>> What have you tried so far?
>>
>>
>>
>> Regards
>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "Django users" group.
>> To unsubscribe from this group and stop receiving emails from it, send an
>> email to django-users+unsubscr...@googlegroups.com.
>> To view this discussion on the web visit
>> https://groups.google.com/d/msgid/django-users/c1092b58-9d91-4d9c-8654-54df883c5172n%40googlegroups.com
>> <https://groups.google.com/d/msgid/django-users/c1092b58-9d91-4d9c-8654-54df883c5172n%40googlegroups.com?utm_medium=email_source=footer>
>> .
>>
>>
>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "Django users" group.
>> To unsubscribe from this group and stop receiving emails from it, send an
>> email to django-users+unsubscr...@googlegroups.com.
>> To view this discussion on the web visit
>> https://groups.google.com/d/msgid/django-users/80F9CD37-925E-4CB1-A03D-743C8F10EDB4%40hxcore.ol
>> <https://groups.google.com/d/msgid/django-users/80F9CD37-925E-4CB1-A03D-743C8F10EDB4%40hxcore.ol?utm_medium=email_source=footer>
>> .
>>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/CAGDmY67kWhDN1bn%2BWtTcLxCj-QfmzG2F77b-2Hpbo9ouths1Gg%40mail.gmail.com
> <https://groups.google.com/d/msgid/django-users/CAGDmY67kWhDN1bn%2BWtTcLxCj-QfmzG2F77b-2Hpbo9ouths1Gg%40mail.gmail.com?utm_medium=email_source=footer>
> .
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAGiJVX0HsA0tKenVKbAaTDwb5TxR0umHPogUUnAH%3DU94GUumjA%40mail.gmail.com.


Re: How to get data from django model to excel sheet using openpyxl including images.

2020-07-10 Thread Ashutosh Mishra
I am doing that using openpyxl
But not getting the image in excel sheet

https://stackoverflow.com/questions/62695531/cannot-convert-fieldfile-jpg-to-excel-django

See this

On Fri, Jul 10, 2020, 7:15 PM Vishesh Mangla 
wrote:

> Api’s are better suited for Django rest framework.
>
>
>
> Sent from Mail <https://go.microsoft.com/fwlink/?LinkId=550986> for
> Windows 10
>
>
>
> *From: *Ashutosh Mishra 
> *Sent: *10 July 2020 18:30
> *To: *Django users 
> *Subject: *Re: How to get data from django model to excel sheet using
> openpyxl including images.
>
>
>
> i have created an api through which i can download the excel file with all
> fields except images.I am posting my models and views
>
>
>
> models.py
>
>
>
> class Task(models.Model):
>
>
>
> Id=models.IntegerField()
>
> Name=models.CharField(max_length=50,null=False,blank=True)
>
> Image1=models.FileField(blank=True, default="",
>
> upload_to="media/images",null=True)
>
> Image2=models.FileField(blank=True, default="",
>
> upload_to="media/images",null=True)
>
> Date=models.DateField(null=True,blank=True)
>
> def __str__(self):
>
> return str(self.Name)
>
>
>
> views.py
>
> class TaskViewSet(viewsets.ViewSet):
>
>
>
> def list(self,request):
>
> try:
>
> queryset=Task.objects.all()
>
> response = HttpResponse(content_type='application/ms-excel')
>
> #response=HttpResponse(content_type='application/ms-excel')
>
>
>
> #response['Content-Disposition'] = 'attachment; filename="users.xls'
>
> response['Content-Disposition']='attachment; filename="users.xls"'
>
>
>
> wb=openpyxl.Workbook()
>
> ws=wb.active
>
>
>
> row_num=0
>
> columns=['Id','Name','Image1','Image2','Date']
>
>
>
> for col_num in range(len(columns)):
>
> c = ws.cell(row=row_num + 1, column=col_num + 1)
>
> c.value = columns[col_num]
>
> for obj in queryset:
>
> row_num+=1
>
> row = [
>
> obj.Id,
>
> obj.Name,
>
> obj.Image1.url,
>
> obj.Image2.url,
>
> str(obj.Date),
>
> ]
>
> print(type(row))
>
>
>
> for col_num in range(len(row)):
>
> c = ws.cell(row=row_num + 1, column=col_num + 1)
>
> c.value = row[col_num]
>
>
>
> wb.save(response)
>
> return response
>
> except Exception as error:
>
> traceback.print_exc()
>
> return Response({"message": str(error), "success": False},
> status=status.HTTP_200_OK)
>
>
>
>
>
> On Friday, July 10, 2020 at 5:48:36 PM UTC+5:30 ajoeiam wrote:
>
> On Thu, Jul 9, 2020 at 10:02 PM Ashutosh Mishra 
> wrote:
>
> I am creating an api to get data and images from django model to excel
> sheet ,how can i do that,someone please help me.
>
>
>
> What have you tried so far?
>
>
>
> Regards
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/c1092b58-9d91-4d9c-8654-54df883c5172n%40googlegroups.com
> <https://groups.google.com/d/msgid/django-users/c1092b58-9d91-4d9c-8654-54df883c5172n%40googlegroups.com?utm_medium=email_source=footer>
> .
>
>
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/80F9CD37-925E-4CB1-A03D-743C8F10EDB4%40hxcore.ol
> <https://groups.google.com/d/msgid/django-users/80F9CD37-925E-4CB1-A03D-743C8F10EDB4%40hxcore.ol?utm_medium=email_source=footer>
> .
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAGDmY67kWhDN1bn%2BWtTcLxCj-QfmzG2F77b-2Hpbo9ouths1Gg%40mail.gmail.com.


RE: How to get data from django model to excel sheet using openpyxl including images.

2020-07-10 Thread Vishesh Mangla
Api’s are better suited for Django rest framework. Sent from Mail for Windows 10 From: Ashutosh MishraSent: 10 July 2020 18:30To: Django usersSubject: Re: How to get data from django model to excel sheet using openpyxl including images. i have created an api through which i can download the excel file with all fields except images.I am posting my models and views models.py class Task(models.Model): Id=models.IntegerField()Name=models.CharField(max_length=50,null=False,blank=True)Image1=models.FileField(blank=True, default="",upload_to="media/images",null=True)Image2=models.FileField(blank=True, default="",upload_to="media/images",null=True)Date=models.DateField(null=True,blank=True)def __str__(self):return str(self.Name) views.pyclass TaskViewSet(viewsets.ViewSet): def list(self,request):try:queryset=Task.objects.all()response = HttpResponse(content_type='application/ms-excel')#response=HttpResponse(content_type='application/ms-excel') #response['Content-Disposition'] = 'attachment; filename="users.xls'response['Content-Disposition']='attachment; filename="users.xls"' wb=openpyxl.Workbook()ws=wb.active row_num=0columns=['Id','Name','Image1','Image2','Date'] for col_num in range(len(columns)):c = ws.cell(row=row_num + 1, column=col_num + 1)c.value = columns[col_num]for obj in queryset:row_num+=1row = [obj.Id,obj.Name,obj.Image1.url,obj.Image2.url,str(obj.Date),]print(type(row)) for col_num in range(len(row)):c = ws.cell(row=row_num + 1, column=col_num + 1)c.value = row[col_num] wb.save(response)return responseexcept Exception as error:traceback.print_exc()return Response({"message": str(error), "success": False}, status=status.HTTP_200_OK)  On Friday, July 10, 2020 at 5:48:36 PM UTC+5:30 ajoeiam wrote:On Thu, Jul 9, 2020 at 10:02 PM Ashutosh Mishra  wrote:I am creating an api to get data and images from django model to excel sheet ,how can i do that,someone please help me.   What have you tried so far? Regards -- You received this message because you are subscribed to the Google Groups "Django users" group.To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscr...@googlegroups.com.To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/c1092b58-9d91-4d9c-8654-54df883c5172n%40googlegroups.com. 



-- 
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/80F9CD37-925E-4CB1-A03D-743C8F10EDB4%40hxcore.ol.


Re: How to get data from django model to excel sheet using openpyxl including images.

2020-07-10 Thread Ashutosh Mishra
i have created an api through which i can download the excel file with all 
fields except images.I am posting my models and views

models.py

class Task(models.Model):

Id=models.IntegerField()
Name=models.CharField(max_length=50,null=False,blank=True)
Image1=models.FileField(blank=True, default="",
upload_to="media/images",null=True)
Image2=models.FileField(blank=True, default="",
upload_to="media/images",null=True)
Date=models.DateField(null=True,blank=True)
def __str__(self):
return str(self.Name)

views.py
class TaskViewSet(viewsets.ViewSet):

def list(self,request):
try:
queryset=Task.objects.all()
response = HttpResponse(content_type='application/ms-excel')
#response=HttpResponse(content_type='application/ms-excel')

#response['Content-Disposition'] = 'attachment; filename="users.xls'
response['Content-Disposition']='attachment; filename="users.xls"'

wb=openpyxl.Workbook()
ws=wb.active

row_num=0
columns=['Id','Name','Image1','Image2','Date']

for col_num in range(len(columns)):
c = ws.cell(row=row_num + 1, column=col_num + 1)
c.value = columns[col_num]
for obj in queryset:
row_num+=1
row = [
obj.Id,
obj.Name,
obj.Image1.url,
obj.Image2.url,
str(obj.Date),
]
print(type(row))

for col_num in range(len(row)):
c = ws.cell(row=row_num + 1, column=col_num + 1)
c.value = row[col_num]

wb.save(response)
return response
except Exception as error:
traceback.print_exc()
return Response({"message": str(error), "success": False}, 
status=status.HTTP_200_OK)


On Friday, July 10, 2020 at 5:48:36 PM UTC+5:30 ajoeiam wrote:

> On Thu, Jul 9, 2020 at 10:02 PM Ashutosh Mishra  
> wrote:
>
>> I am creating an api to get data and images from django model to excel 
>> sheet ,how can i do that,someone please help me.  
>>
>>
>> What have you tried so far?
>
> Regards 
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/c1092b58-9d91-4d9c-8654-54df883c5172n%40googlegroups.com.


Re: How to get data from django model to excel sheet using openpyxl including images.

2020-07-10 Thread o1bigtenor
On Thu, Jul 9, 2020 at 10:02 PM Ashutosh Mishra 
wrote:

> I am creating an api to get data and images from django model to excel
> sheet ,how can i do that,someone please help me.
>
>
> What have you tried so far?

Regards

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAPpdf58f0qp7xEEYCBu694TNyXFXpLiLU1tcDKNFYQgp7jOM1w%40mail.gmail.com.


How to get data from django model to excel sheet using openpyxl including images.

2020-07-09 Thread Ashutosh Mishra
I am creating an api to get data and images from django model to excel 
sheet ,how can i do that,someone please help me.

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/fff2b0b5-e4d9-423c-ac8d-b1ccc26c2109n%40googlegroups.com.


Unable to export images from django model to excel sheet

2020-07-04 Thread Ashutosh Mishra
I have posted on stack overflow.I want export images from django model to excel 
sheet.while doing I am just getting the root media address on excel sheet not 
image.
Please help ,it's urgent.

https://stackoverflow.com/questions/62695531/unable-to-export-images-from-django-model-to-excel-sheet-using-xlwt

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/b421efaa-4ba6-4bf6-bd09-e7ee8ad7cfdao%40googlegroups.com.


Re: Django Uploaded images not displayed in production

2020-06-22 Thread MUGOYA DIHFAHSIH
thanks Anton, i will also give nginx a try but currently the client has a
domain with namecheap with shared host plan and that is where he wants me
to deploy the application but name cheap has apache web server


On Sun, 21 Jun 2020 at 22:10, Anton Nyagolov  wrote:

> So guys I have found the problem. My Nginx server was only serving static
> files but not media ones, I have probably forgot about it.
> My Nginx settings were:
> The only thing I had to do is add a location for the media folder:
>
>
> @MUGOYA DIHFAHSIH
> At the begging of setting the server I also used apache2, it was pain in
> the ass and I switched to Nguix and Gunicorn. Setting the server over
> apache took me like 60-70 steps. With Nguix and Gunicorn it takes only 20
> steps, for 15 min you are all set up.
> Watch this video and follow the guy: How to Deploy Python-Django serveer
> in 20 min 
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/343c056c-cd83-4ce2-a898-ecf21ef0165fo%40googlegroups.com
> 
> .
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAP%3DJD9xJXWuZVN%2Bpwk9pJJefPp%3DOuyqRCzfFCa%3DOEksb5CqvpA%40mail.gmail.com.


Re: Django Uploaded images not displayed in production

2020-06-21 Thread Anton Nyagolov
So guys I have found the problem. My Nginx server was only serving static 
files but not media ones, I have probably forgot about it. 
My Nginx settings were: 
The only thing I had to do is add a location for the media folder:


@MUGOYA DIHFAHSIH
At the begging of setting the server I also used apache2, it was pain in 
the ass and I switched to Nguix and Gunicorn. Setting the server over 
apache took me like 60-70 steps. With Nguix and Gunicorn it takes only 20 
steps, for 15 min you are all set up.
Watch this video and follow the guy: How to Deploy Python-Django serveer in 
20 min 

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/343c056c-cd83-4ce2-a898-ecf21ef0165fo%40googlegroups.com.


Re: Django Uploaded images not displayed in production

2020-06-21 Thread MUGOYA DIHFAHSIH
Actually me too i have the same problem, i have deployed django web app on
a shared host with apache linux server, and am stuck on how to serve media
files, static files like js, css, and static images not from database load
well.

But the problem is that when i submit a form that has an imagefield with
it, it throws an error message, "404" page not found.
If anyone can help me please.

On Sun, Jun 21, 2020, 21:23 Vishesh Mangla 
wrote:

> If the issue is managing static files on the server simply installing
> Django-heroku saved me from all that trouble.
>
>
>
> Sent from Mail <https://go.microsoft.com/fwlink/?LinkId=550986> for
> Windows 10
>
>
>
> *From: *Rob Riedlinger 
> *Sent: *21 June 2020 23:40
> *To: *Django users 
> *Subject: *Re: Django Uploaded images not displayed in production
>
>
>
> Check out this video  https://youtu.be/kBwhtEIXGII  Denis talks about why
> this happens
>
> On Sunday, June 21, 2020 at 7:15:43 PM UTC+2, Anton Nyagolov wrote:
>
> Thanks I will check out the group too for future reference and etc. Those
> images are uploaded to a database and are part of a model. I iterate
> through all the object and for each object I print some information
> including the images, therefore I cannot specify only one specific image. I
> use admin so I can add my (new future) projects and only by admin they
> should be able to display automatically on my website with all the
> information and structure required.
>
> Do you sugest changing the value of the imageField
> (upload_to="static//my_desired_path) ?
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/33d4c599-135d-45d9-abbc-978e404e4f87o%40googlegroups.com
> <https://groups.google.com/d/msgid/django-users/33d4c599-135d-45d9-abbc-978e404e4f87o%40googlegroups.com?utm_medium=email_source=footer>
> .
>
>
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/A68703DE-32D6-417B-AF0F-64EACA533FE0%40hxcore.ol
> <https://groups.google.com/d/msgid/django-users/A68703DE-32D6-417B-AF0F-64EACA533FE0%40hxcore.ol?utm_medium=email_source=footer>
> .
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAP%3DJD9x7L7S9KniwHQ4etsjnCOfj70AizbZO-1z5WxqCbLpnsg%40mail.gmail.com.


RE: Django Uploaded images not displayed in production

2020-06-21 Thread Vishesh Mangla
If the issue is managing static files on the server simply installing Django-heroku saved me from all that trouble. Sent from Mail for Windows 10 From: Rob RiedlingerSent: 21 June 2020 23:40To: Django usersSubject: Re: Django Uploaded images not displayed in production Check out this video  https://youtu.be/kBwhtEIXGII  Denis talks about why this happensOn Sunday, June 21, 2020 at 7:15:43 PM UTC+2, Anton Nyagolov wrote:Thanks I will check out the group too for future reference and etc. Those images are uploaded to a database and are part of a model. I iterate through all the object and for each object I print some information including the images, therefore I cannot specify only one specific image. I use admin so I can add my (new future) projects and only by admin they should be able to display automatically on my website with all the information and structure required. Do you sugest changing the value of the imageField (upload_to="static//my_desired_path) ? -- You received this message because you are subscribed to the Google Groups "Django users" group.To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscr...@googlegroups.com.To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/33d4c599-135d-45d9-abbc-978e404e4f87o%40googlegroups.com. 



-- 
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/A68703DE-32D6-417B-AF0F-64EACA533FE0%40hxcore.ol.


Re: Django Uploaded images not displayed in production

2020-06-21 Thread Rob Riedlinger
Check out this video  https://youtu.be/kBwhtEIXGII  Denis talks about why 
this happens

On Sunday, June 21, 2020 at 7:15:43 PM UTC+2, Anton Nyagolov wrote:
>
> Thanks I will check out the group too for future reference and etc. Those 
> images are uploaded to a database and are part of a model. I iterate 
> through all the object and for each object I print some information 
> including the images, therefore I cannot specify only one specific image. I 
> use admin so I can add my (new future) projects and only by admin they 
> should be able to display automatically on my website with all the 
> information and structure required. 
> Do you sugest changing the value of the imageField 
> (upload_to="static//my_desired_path) ? 
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/33d4c599-135d-45d9-abbc-978e404e4f87o%40googlegroups.com.


RE: Django Uploaded images not displayed in production

2020-06-21 Thread Vishesh Mangla
Sorry, I misunderstood your problem. But can you also show your views.py. Also your path to MEDIA_ROOT is obfuscated. I used MEDIA_ROOT = os.path.join(BASE_DIR, 'media'). I thing this shall be sufficient to do for a try.  Sent from Mail for Windows 10 From: Anton NyagolovSent: 21 June 2020 22:46To: Django usersSubject: Re: Django Uploaded images not displayed in production Thanks I will check out the group too for future reference and etc. Those images are uploaded to a database and are part of a model. I iterate through all the object and for each object I print some information including the images, therefore I cannot specify only one specific image. I use admin so I can add my (new future) projects and only by admin they should be able to display automatically on my website with all the information and structure required. Do you sugest changing the value of the imageField (upload_to="static//my_desired_path) ? -- You received this message because you are subscribed to the Google Groups "Django users" group.To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscr...@googlegroups.com.To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/d4758123-f506-401b-b488-c3f17385d9fco%40googlegroups.com. 



-- 
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/C64216E4-101F-4398-8264-9499B18F82C2%40hxcore.ol.


Re: Django Uploaded images not displayed in production

2020-06-21 Thread Anton Nyagolov
Thanks I will check out the group too for future reference and etc. Those 
images are uploaded to a database and are part of a model. I iterate 
through all the object and for each object I print some information 
including the images, therefore I cannot specify only one specific image. I 
use admin so I can add my (new future) projects and only by admin they 
should be able to display automatically on my website with all the 
information and structure required. 
Do you sugest changing the value of the imageField 
(upload_to="static//my_desired_path) ? 

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/d4758123-f506-401b-b488-c3f17385d9fco%40googlegroups.com.


RE: Django Uploaded images not displayed in production

2020-06-21 Thread Vishesh Mangla
Hi, first of all welcome on this group. Secondly you can also try https://webchat.freenode.net/  on the #django channel but you first need to register there by asking on #freenode channel. Regarding your problem, images are static files and you should put them in static//your_desired_path to be detectable not media if they are part of your templates. Use src="" url “your_desired_path %} and don’t forget to put {% load static %} at the top of your template. Sent from Mail for Windows 10 From: Anton NyagolovSent: 21 June 2020 22:29To: Django usersSubject: Django Uploaded images not displayed in production Hello everyone, I just discovered this group through Google.I couldn't get any help on stack overflow and hopefully someone here can help. I have deployed a Django App on a Ubuntu server for the first time using Nginx and gunicorn. Before deployment, I used port 8000 to test if everything runs as it is supposed to and all was fine. Since I allowed 'Nginx Full' my database images are not showing up. This is my django project structure:My virtual environment folder and my main project folder are both in the same directory. I have separated them. ```python# Create your models here.class Project(models.Model):    project_name = models.CharField(max_length=120)    project_description = models.CharField(max_length=400)    project_link = models.CharField(max_length=500)    project_image = models.ImageField(upload_to='')    def __str__(self):    return self.project_name``` I have set up my settings.py to :```python# Build paths inside the project like this: os.path.join(BASE_DIR, ...)BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))STATIC_URL = '/static/'STATIC_ROOT = os.path.join(BASE_DIR, 'static')MEDIA_URL = '/media/'MEDIA_ROOT = os.path.join(os.path.dirname(__file__), '..', 'media').replace('\\','/')```My view gets all the project object from a database and passes those to the template. The template renders successfully all other information related to project model except the image field . In my template I do: ```html  {% for project in projects %}    {% if forloop.counter|mod:2 == 0 %}      {% else %}      {% endif %}      alt="Image could not be found :(" style="height:120px; width:166px !important;" />      {{ project.project_name }}  {{ project.project_description}}  Link        {% if forloop.counter|mod:2 == 0 %}    {% endif %}  {% endfor%}      ```Uploading the images works, it sends them in the project's media directory, the problem is that they are not showing up, the alt="" is activated. My main urls.py: ```pythonurlpatterns = [ path('', include('project.urls')),    path('admin/', admin.site.urls),]  + static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)```The gunicorn system file:```[Unit]Description=gunicorn daemonAfter=network.target[Service]User=myusernameGroup=www-dataWorkingDirectory=/home/myusername/myprojectExecStart=/home/myusername/venv/bin/gunicorn --access-logfile - --workers 3 --bind unix:/home/myusername/myproject/myproject.sock myproject.wsgi:application[Install]WantedBy=multi-user.target```Nginx setup:```  server {    listen 80;    server_name  ;    location = /favicon.ico { access_log off; log_not_found off; }    location /static/ {    root /home/myusername/myproject;    }    location / {    include proxy_params;    proxy_pass http://unix:/home/myusername/myproject/myproject.sock;    }    }```EDIT: When inspecting the image element of the webpage the source of the image it is "/media/imageNmae.png". Any help would be appreciated!-- You received this message because you are subscribed to the Google Groups "Django users" group.To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscr...@googlegroups.com.To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/635fcf7e-6e53-425d-aad1-8638fef425c1o%40googlegroups.com. 



-- 
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/CCDBA280-8772-4A69-9698-430CB19A687A%40hxcore.ol.


Django Uploaded images not displayed in production

2020-06-21 Thread Anton Nyagolov
Hello everyone, I just discovered this group through Google.I couldn't get 
any help on stack overflow and hopefully someone here can help. 

I have deployed a Django App on a Ubuntu server for the first time using 
Nginx and gunicorn. 
Before deployment, I used port 8000 to test if everything runs as it is 
supposed to and all was fine. Since I allowed 'Nginx Full' my database 
images are not showing up. 

This is my django project structure:



My virtual environment folder and my main project folder are both in the 
same directory. I have separated them. 

```python
# Create your models here.
class Project(models.Model):
project_name = models.CharField(max_length=120)
project_description = models.CharField(max_length=400)
project_link = models.CharField(max_length=500)
project_image = models.ImageField(upload_to='')

def __str__(self):
return self.project_name
``` 
I have set up my settings.py to :
```python
# Build paths inside the project like this: os.path.join(BASE_DIR, ...)
BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))

STATIC_URL = '/static/'
STATIC_ROOT = os.path.join(BASE_DIR, 'static')


MEDIA_URL = '/media/'
MEDIA_ROOT = os.path.join(os.path.dirname(__file__), '..', 
'media').replace('\\','/')
```

My view gets all the project object from a database and passes those to the 
template. The template renders successfully all other information related 
to project model except the image field . In my template I do: 
```html 
 

{% for project in projects %}
{% if forloop.counter|mod:2 == 0 %}

  {% else %}
  
{% endif %}



  {{ project.project_name }}
  {{ 
project.project_description}}
  Link


  

  {% if forloop.counter|mod:2 == 0 %}
  
  {% endif %}
  {% endfor%}

  
```
Uploading the images works, it sends them in the project's media directory, 
the problem is that they are not showing up, the alt="" is activated. 


My main urls.py: 
```python
urlpatterns = [
 path('', include('project.urls')),
path('admin/', admin.site.urls),
]  + static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)
```
The gunicorn system file:
```

[Unit]
Description=gunicorn daemon
After=network.target

[Service]
User=myusername
Group=www-data
WorkingDirectory=/home/myusername/myproject
ExecStart=/home/myusername/venv/bin/gunicorn --access-logfile - --workers 3 
--bind unix:/home/myusername/myproject/myproject.sock 
myproject.wsgi:application

[Install]
WantedBy=multi-user.target

```
Nginx setup:
```
  server {
listen 80;
server_name  ;
location = /favicon.ico { access_log off; log_not_found off; }
location /static/ {
root /home/myusername/myproject;
}
location / {
include proxy_params;
proxy_pass 
http://unix:/home/myusername/myproject/myproject.sock;
}
}
```


EDIT: When inspecting the image element of the webpage the source of the 
image it is "/media/imageNmae.png". 
Any help would be appreciated!

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/635fcf7e-6e53-425d-aad1-8638fef425c1o%40googlegroups.com.


Uploading images in browsable API

2020-06-16 Thread Filip Bogdanovski
Hello everyone,

I was wondering if someone know why my field for uploading pictures is like 
this? I can't select new pictures from my computer to upload, only ones 
already uploaded in the model instances through my Admin panel. It looks 
this way on my all of my routes.

Here is link for my github repository - 
https://github.com/eonbre/DogApi1/tree/master/DrWebTestProject

I would also love if someone would help me to return a random image on my 
/breeds//random route.

Kind Regards,
Filip

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/1edcc4a5-8e87-41e0-a9fa-7038f15cf8e9o%40googlegroups.com.


Re: How to handle non-uploaded dynamic images ?

2020-05-12 Thread Ryan Nowakowski
On Fri, May 08, 2020 at 06:47:22PM -0700, Dorian LE NET wrote:
> Let's say I have a django app where users can display images by choosing 
> among infinite parameters through a form. These images do not exist before 
> the user generate them as they are built accordingly to its selection of 
> parameters. Such images are dynamically and internally generated. Then they 
> are neither static nor uploaded by users.
> 
> 
> How should I store such images ? As *static* images, as *media* images or 
> as a customized category ?
> 
> 
> As images are internally generated and not uploaded by users, it does not 
> seem necessary to use the file storage systems and the /media/ location. 
> But it does not seem clever to use the /static/ directory either, as many 
> images will be added (and removed) - they are not static by definition.
> 
> 
> I would also like to use a model that contains these images and other 
> information about them. What model field class should I use to handle them 
> ? As the images are not uploaded by users models.ImageField does not seem 
> appropriate.

My rule of thumb is that if an image is referenced in the database then
it goes under "media".

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/20200512144027.GF29564%40fattuba.com.


How to handle non-uploaded dynamic images ?

2020-05-08 Thread Dorian LE NET
Let's say I have a django app where users can display images by choosing 
among infinite parameters through a form. These images do not exist before 
the user generate them as they are built accordingly to its selection of 
parameters. Such images are dynamically and internally generated. Then they 
are neither static nor uploaded by users.


How should I store such images ? As *static* images, as *media* images or 
as a customized category ?


As images are internally generated and not uploaded by users, it does not 
seem necessary to use the file storage systems and the /media/ location. 
But it does not seem clever to use the /static/ directory either, as many 
images will be added (and removed) - they are not static by definition.


I would also like to use a model that contains these images and other 
information about them. What model field class should I use to handle them 
? As the images are not uploaded by users models.ImageField does not seem 
appropriate.


Thank you 

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/17300edd-0638-448c-aba6-3fbd12a1198c%40googlegroups.com.


How to get previously uploaded Images in Django

2020-05-04 Thread Nomeh Uchenna Gabriel
You should read about customising the admin here: 
https://docs.djangoproject.com/en/3.0/intro/tutorial07/

... but I suggest that you build your own website control panel which will 
control your website with API's 

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/37568d09-e5a6-4ab4-be12-ed2881d6d119%40googlegroups.com.


  1   2   3   4   5   6   7   8   9   10   >