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:
>> <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.

-- 
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 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: Create table and load data

2012-10-11 Thread Joseph Wayodi
On Thu, Oct 11, 2012 at 2:23 AM, Larry Martell  wrote:
> I'm having trouble getting django to read my fixture file. I created it in 
> yaml:
>
> - model: cdsem.fields
>pk: 1
>fields:
>  name: data_file_id
>  description: data_file_id
> - model: cdsem.fields
>pk: 2
>fields:
>  name: tool_id
>  description: tool_id
>
> and so on.
>
> I put it in a file called initial_data.yaml in the fixtures dir of my
> app. When I run syncdb it does not pick it up. FIXTURE_DIRS was not
> set. I should not have to set it, but I did anyway, but it still did
> not pick up the file. If I run loaddata and give it the path to the
> file I get:
>
> Problem installing fixture './fixtures/initial_data': yaml is not a
> known serialization format.
>
> The docs say yaml is supported. What am I doing wrong?
>

According to the docs [1], you may need to install PyYAML:
.

[1] 


Joseph.

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: How to get hold of a (database) connection from within a thread

2010-11-04 Thread Joseph Wayodi
On Thu, Nov 4, 2010 at 3:12 PM, Jirka Vejrazka wrote:

> > How can I get hold of the connection used to create the object, from
> within
> > each thread, so that each thread closes the connection that it has just
> > used? Alternatively, how can I get a list of all the open connections
> that
> > Django is using at any one time. I am using the "standard" model query
> API,
> > and not executing custom SQL directly.
>
>   Hi Joseph,
>
>  I use simple:
>
> >>> from django.db import connection
> >>> connection.close()
>
>  Please note that this is pre-multidb support, so you'll probably
> have to use the connections dictionary - see multi-db documentation
> for details.
>
>
Thanks a lot Jirka. Calling this from inside each thread seems to have done
it for me:

>>> from django.db import connections
>>> for connection in connections.all(): connection.close()

Regards,

Joseph.

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



How to get hold of a (database) connection from within a thread

2010-11-04 Thread Joseph Wayodi
Hi people,

I am running some Django code that creates objects in the database. I am
using PostgreSQL via psycopg2. However, I am running this code from the
Django shell, and not as part of a request. I therefore have to handle a few
things manually, for example, closing connections to the database. The code
creates multiple threads to do the object creation, and I soon hit the
maximum limit of allowed connections to the database.

How can I get hold of the connection used to create the object, from within
each thread, so that each thread closes the connection that it has just
used? Alternatively, how can I get a list of all the open connections that
Django is using at any one time. I am using the "standard" model query API,
and not executing custom SQL directly.

Thanks,

Joseph.

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.