Re: image handling

2015-03-24 Thread Akash Patni
Hi, Can i use this method in my model.py def save(self, *args, **kwargs): try: this = MyModelName.objects.get(id=self.id) if this.MyImageFieldName != self.MyImageFieldName: this.MyImageFieldName.delete() except: pass super(MyModelName, self).save(*args,

Re: image handling

2015-03-24 Thread Akash Patni
Hi, I have added the code to my __init__.py file but still its not working. __init__.py from django.core.files.storage import default_storage as storage from django.db.models.signals import pre_save from django.db import models import django.forms as forms from django.contrib.auth.models import

how to initiate an interactive python script from an html cgi?

2015-03-24 Thread arthur sherman
i have a python script which currently runs in a shell cli. i'd like to initiate this script from a web page. the closest i got was to have the output displayed on the webpage (w/o linefeeds), but it crashed when requesting input via raw_input(). i simply did 'exec python-script-name' from the

Re: Re-run only tests that failed last time

2015-03-24 Thread Carl Meyer
Hi Gergely, On 03/24/2015 04:27 AM, Gergely Polonkai wrote: > I have a pretty extended test suite for my application, which can run > for about 15 minutes. Now when I introduce an error, I will be notified > of it pretty late, and a one-liner fix needs another 15 minutes to > check. Of course if

Re: Re-run only tests that failed last time

2015-03-24 Thread Gergely Polonkai
Hello Russ, I've already installed the juno test runner, but a graphical tool cannot hurt locally  I'll check it out tomorrow, thanks for the link! Best, Gergely On 24 Mar 2015 23:22, "Russell Keith-Magee" wrote: > Hi Gergely, > > One option is to use a test suite GUI

Re: Re-run only tests that failed last time

2015-03-24 Thread Russell Keith-Magee
Hi Gergely, One option is to use a test suite GUI tool, like cricket: http://pybee.org/cricket Cricket lets you view your entire test suite as a tree, select subsets of the suite to run, see test results as the suite executes, and re-run the failures from the previous execution. Yours, Russ

Why is list(Model.objects.all()) 10x slower against an Oracle database as compared to Postgres?

2015-03-24 Thread Daniel Porter
I have an application that we run locally against a postgres database but our dev/test/prod servers all run Oracle. The command list(Person.objects.all()) runs remarkably faster against my local Postgresql database. It takes at least 10x longer against an Oracle database. The thing is the

Re: Re-run only tests that failed last time

2015-03-24 Thread Gergely Polonkai
@Erik: On the CI side, certainly, I will run all the tests upon each commit. I want to utilize this thing only on my developer machine, so I can do a quick run after I think I fixed a problem. Naturally, if those failing tests are green, I will run the whole suite again. Separating/tweaking my

Re: image handling

2015-03-24 Thread Andreas Kuhne
First, make sure that the whitespace is the same in all of your methods (in python whitespace is significant, which means that you should indent all files the same amount, I wrote my example in my email, so I only indented twice, you seem to have 4 blankspaces in your file, so make sure the

Re: Re-run only tests that failed last time

2015-03-24 Thread Ramiro Morales
On Tue, Mar 24, 2015 at 7:27 AM, Gergely Polonkai wrote: > Hello, > > I have a pretty extended test suite for my application, which can run for > about 15 minutes. Now when I introduce an error, I will be notified of it > pretty late, and a one-liner fix needs another 15

Re: Re-run only tests that failed last time

2015-03-24 Thread Erik Cederstrand
> Den 24/03/2015 kl. 11.27 skrev Gergely Polonkai : > > I have a pretty extended test suite for my application, which can run for > about 15 minutes. Now when I introduce an error, I will be notified of it > pretty late, and a one-liner fix needs another 15 minutes to

Re: image handling

2015-03-24 Thread Akash Patni
i had made the changes in model .py but its not working here is model.py from django.db import models import django.forms as forms from virtualenv import REQUIRED_FILES from _mysql import NULL from datetime import datetime, date, time, timedelta import time import calendar from

Re: image handling

2015-03-24 Thread Akash Patni
is there any other changes that i have to made in model like how this above mentioned function will be call. Please suggest On Tue, Mar 24, 2015 at 6:43 PM, Andreas Kuhne wrote: > Hi, > > You shouldn't do it in the view, do it in the database model instead. It >

Re: image handling

2015-03-24 Thread Andreas Kuhne
Hi, You shouldn't do it in the view, do it in the database model instead. It won't do anything to any other fields than the image field the way I wrote the function (all other fields are untouched). The reason you shouldn't do it in the view, is because if you were to update the image any other

Re: Image resizing

2015-03-24 Thread Andreas Kuhne
You can use Pillow to change the size of the images yourself. That is however pretty complicated and IMO not really worth the effort. I would go with easy_thumbnails. Regards, Andréas 2015-03-24 14:04 GMT+01:00 Akash Patni : > can you please suggest me another

Re: image handling

2015-03-24 Thread Akash Patni
Hey, I am new to django. I have other feilds also other than image field in my form, so will you please tell me how to use above mentioned function in edit_profile function in view, Can i call another function from another function in views.py, if yes please tell me On Tue, Mar 24, 2015 at 6:11

Re: Image resizing

2015-03-24 Thread Akash Patni
can you please suggest me another answer... On Tue, Mar 24, 2015 at 6:13 PM, Andreas Kuhne wrote: > Hi, > > Check out the easy_thumbnails plugin. > http://easy-thumbnails.readthedocs.org/en/2.1/ > > It automatically resizes all images to the size you want if you use

Re: Re-run only tests that failed last time

2015-03-24 Thread Andreas Kuhne
If you have created packages for your tests, you can run all tests in a package. If the tests aren't in the same package, it won't help you however. Regards, Andréas 2015-03-24 11:27 GMT+01:00 Gergely Polonkai : > Hello, > > I have a pretty extended test suite for my

Re: Image resizing

2015-03-24 Thread Andreas Kuhne
Hi, Check out the easy_thumbnails plugin. http://easy-thumbnails.readthedocs.org/en/2.1/ It automatically resizes all images to the size you want if you use it correctly. Regards, Andréas 2015-03-24 11:07 GMT+01:00 : > Hi.. > can anyone please tell me how to resize

Re: image handling

2015-03-24 Thread Andreas Kuhne
Hi, Ok, so what you should do is add a signal to pre save and then delete the old image if the new image is attached. Something like this should work: from django.core.files.storage import default_storage as storage from django.db.models.signals import pre_save def image_delete(sender,

Re: image handling

2015-03-24 Thread akash . patni
When i edit image that is when i upload new image,the old image should get deleted On Tuesday, March 24, 2015 at 2:40:35 PM UTC+5:30, akash...@ranosys.com wrote: > > hi.. > Can anyone please tell me how to handle old image after uploading new > image. > -- You received this message because

Re: image handling

2015-03-24 Thread aRkadeFR
When do you want to delete the old image? On 03/24/2015 10:59 AM, akash.pa...@ranosys.com wrote: Hi , I want to delete the old image. On Tuesday, March 24, 2015 at 2:40:35 PM UTC+5:30, akash...@ranosys.com wrote: hi.. Can anyone please tell me how to handle old image after uploading

Re-run only tests that failed last time

2015-03-24 Thread Gergely Polonkai
Hello, I have a pretty extended test suite for my application, which can run for about 15 minutes. Now when I introduce an error, I will be notified of it pretty late, and a one-liner fix needs another 15 minutes to check. Of course if only one of my tests fail, I can add the name of the test

Re: image handling

2015-03-24 Thread akash . patni
hi any answer On Tuesday, March 24, 2015 at 2:40:35 PM UTC+5:30, akash...@ranosys.com wrote: > > hi.. > Can anyone please tell me how to handle old image after uploading new > image. > -- You received this message because you are subscribed to the Google Groups "Django users" group.

Re: image handling

2015-03-24 Thread akash . patni
This is my edit profile function in view def edit_profile(request): if 'username' in request.session: user_id=request.POST.get('id') user_id=request.GET.get('id') usr_obj=User.objects.get(id=int(user_id)) if request.method=="POST":

Image resizing

2015-03-24 Thread akash . patni
Hi.. can anyone please tell me how to resize the uploaded image This is my model class User(models.Model): first_name=models.CharField( verbose_name = "First Name *",max_length=20,blank=False) last_name=models.CharField(verbose_name = "Last Name *",max_length=20,blank=False)

Re: image handling

2015-03-24 Thread akash . patni
This is my model class User(models.Model): first_name=models.CharField(verbose_name = "First Name *",max_length=20,blank=False) last_name=models.CharField(verbose_name = "Last Name *",max_length=20,blank=False) username=models.EmailField(verbose_name = "Email

Re: image handling

2015-03-24 Thread akash . patni
Hi , I want to delete the old image. On Tuesday, March 24, 2015 at 2:40:35 PM UTC+5:30, akash...@ranosys.com wrote: > > hi.. > Can anyone please tell me how to handle old image after uploading new > image. > -- You received this message because you are subscribed to the Google Groups "Django

Re: image handling

2015-03-24 Thread Andreas Kuhne
Hi, I think you'll have to be more specific, what do you want to do with the old image? Delete it? Use it again? Regards, Andréas 2015-03-24 10:08 GMT+01:00 : > hi.. > Can anyone please tell me how to handle old image after uploading new > image. > > -- > You received

image handling

2015-03-24 Thread akash . patni
hi.. Can anyone please tell me how to handle old image after uploading new image. -- 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

Re: ProgrammingError: relation "django_content_type" already exists

2015-03-24 Thread Mike Dewhirst
Still not getting very far. The error below* keeps turning up. Further to this, I ran migrate with --list and --settings=ssds.settings.dev and it returns ... admin [ ] 0001_initial auth [ ] 0001_initial [ ] 0002_alter_permission_name_max_length [ ] 0003_alter_user_email_max_length [ ]

ProgrammingError: relation "django_content_type" already exists

2015-03-24 Thread Mike Dewhirst
This is my first stab at upgrading directly from Django 1.6.11 to 1.81c to see what needs to be done. I thought I'd skip 1.7.x - is that a bad idea? Is there some step in 1.7.x which eases the path to 1.8.x? On first starting the project up using runserver on localhost it advises: Python: