Re: Creation of default site not triggering post_save signal

2016-09-10 Thread Simon Charette
Hi Matt, I worked on the changes that broke your code. Starting with 1.10 the migration signals are passed an `apps` kwarg representing the state of models before and after the specified migrations are applied. This allows signal receivers to manipulate model definitions that are synchronized

Creation of default site not triggering post_save signal

2016-09-10 Thread Matt Thompson
Hi All, I have a small Django app that uses the sites framework and has a post_save signal on Site that does some bits and bobs when a new site is created. On 1.9.7, when you run migrations for the first time, it correctly triggers the post_save signal. However, after upgrading to 1.10.1,

Re: Custom Template Tag

2016-09-10 Thread Al Johri
I'm experimenting with creating templates out of subtemplates. These subtemplates can be either (a) simple text or (b) a hash representing a sentence (i.e. {subject: "Dog", verb: "eat", object: "my {{var}}", tense: "past"}). I would like to run the hashes through a realization engine which

Re: problem in converting PIL image object to django file object for saving in imagefield model type

2016-09-10 Thread ali Eblice
Thanks for answering problem solved by seeking here is how i didi it in case of any one needed it: img = Image.open('test.png') #first we open an image with PIL or maybe you have it from uploaded file already(you should import PIL and Image) img_io = io.BytesIO()

Re: A little hitch in Installation!

2016-09-10 Thread ludovic coues
Are you using virtualenv ? 2016-09-10 9:10 GMT+02:00 Tushaar Gangarapu : > Hey, actually I had downloaded Django using pip. Now I tried using $ > django-admin startproject mysite. It shows "Cannot find installed version of > python-django or python3-django." > > A little

Re: Django exit function

2016-09-10 Thread Michal Petrucha
On Sat, Sep 10, 2016 at 01:51:00AM -0700, Krešimir wrote: > Hello, > > I have a turn_the_light_on() function that, well, turns on a light... > I put it in wsgi.py (as suggested by internet) just before application = > get_wsgi_application()call. > > Where can I put turn_the_light_off() function

A little hitch in Installation!

2016-09-10 Thread Tushaar Gangarapu
Hey, actually I had downloaded Django using pip. Now I tried using $ django-admin startproject mysite. It shows "Cannot find installed version of python-django or python3-django." A little help, please! Thanks in Advance :) -- You received this message because you are subscribed to the Google

Django exit function

2016-09-10 Thread Krešimir
Hello, I have a turn_the_light_on() function that, well, turns on a light... I put it in wsgi.py (as suggested by internet) just before application = get_wsgi_application()call. Where can I put turn_the_light_off() function call to turn off the light when the application quits? Thank you! --

Re: problem in converting PIL image object to django file object for saving in imagefield model type

2016-09-10 Thread ludovic coues
Using seek should do the trick. It's a function, taking an offset as its first value and a flag as second value indicating from where to apply the offset. It return the position after the seek operation. So io_object.seek(0, os.SEEK_END) will tell you the number of characters in io_object. That

Re: How modify Django to set URLs with decorators on the view functions like Flask? (rather than using urls.py)

2016-09-10 Thread Michal Petrucha
On Fri, Sep 09, 2016 at 10:11:25PM -0700, Chris Seberino wrote: > Flask has a neat design where instead of having a urls.py file they bind > URLs to view functions with decorators. > > Possible to do something similar with Django? What modifications would be > needed? Personally, I'm not a

Re: is it possible to manipulate image in PIL after uploading directly by its "request.FILES.GETLIST(FORMFIELD)" address not the saved picture on hard disk

2016-09-10 Thread ali Eblice
thanks for answering with your help solved the problem if any one get to this problem, here is how i solved it: filelist = request.FILES.getlist('uploadimage') #first get list of your uploaded file object as list for imgfile in filelist:

problem in converting PIL image object to django file object for saving in imagefield model type

2016-09-10 Thread ali Eblice
Hi everybody I wanted to save PIL image object in model ImageField , but before doing that i have to convert PIL image object to django file-like object I found a solution with stringIO but the problem is that in this solution " io_object.len" is used and "len" is not available in pythin3 here