how to delete in the admin - strategy needed

2013-02-03 Thread Mike Dewhirst
This is the error ... Select a valid choice. That choice is not one of 
the available choices.


I want to delete a bunch of "child" records when a "parent" record is 
deleted. While I'm using that terminology they are not actually related 
in the usual sense. All however are in foreign key relationships with 
the same owner/master.


The child records all know which parents they have because the parent 
added its mark to a field in the child when the child record got created 
and linked to the master. In fact if that child had been added by 
another parent, the next parent just adds its mark instead of adding 
another child.


When a parent gets deleted from the master, its mark is removed from all 
the child records it was involved with and if it was the only mark the 
child gets deleted too. Or at least that is what I want to happen.


My question is:

In overview, how should I be doing this?

At the moment I'm trying to do it all via model methods calling various 
managers because it feels like the right place to do it.


I have tried to make a custom manager with use_for_related_fields = True 
but still get the same error.


Thanks for any help

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 post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.




Re: On the fly image resize

2013-02-03 Thread Sanjay Bhangar
On Mon, Feb 4, 2013 at 6:32 AM, Spencer Summerville  wrote:
> Hello, there are a lot of solutions to resizing images in Django. I commend
> you for wanting to create your own solution, but one of the greatest things
> about Django is that there's tons of projects that people have made that
> solve your problems and usually there's enough of them that you can find one
> that implements itself in a way that lets you do what you want to do. I'm
> not a great programmer and usually these modules are taken from websites
> that in order to function, they have had to work properly in an environment
> where anything can go wrong.
>
> In my own experience, sorl-thumbnail has never let gotten in my way, it lets
> you do what you want and if you want to do something special you can easily
> write your own functionality. Don't want to use PIL? Use ImageMagick or
> write your own class. Have some sort of radical key value cache that nobody
> has ever heard of? Write your own class. Do you want to generate thumbnails
> in a batch process or in the model or in the template? sorl-thumbnail lets
> you choose what you want to do.
>

+1 for sorl. I have been using it for a while now with no significant
problems, and has made thumbnail generation a non-issue.

Sorry for the slightly off-topic statement here, but since we're
talking about Sorl :) - the one problem I've had is this:
In general, I want images to be resized in the format the user uploads
them - i.e. if a user uploads a PNG, I want the thumbnail to be a PNG,
and if the user uploads a JPEG, I want the thumbnail to be a JPEG. It
seems a bit silly, but I have not found a way to do this - I set an
option in settings.py for THUMBNAIL_FORMAT = "PNG", and then all the
thumbnails are PNG, which is non-optimal. And if I set the format to
JPEG, it will take uploaded PNGs with transparencies and convert them
to JPEGs without transparency, which is, again, unacceptable ..

I had looked around a fair bit in the docs, etc. but did not find a
way to specify something like "keep format of uploaded image" - this
was some time ago, though, so I'll check again - if anyone has dealt
with this, though, would love to know how :)

Cheers,
Sanjay



> https://github.com/sorl/sorl-thumbnail
>
>
> On Saturday, February 2, 2013 12:33:36 PM UTC-8, nYmo wrote:
>>
>> Hi all,
>> I'm new to django and also python but have already some programming
>> experience. I'm currently creating my first application in django and get
>> stucked because I'm looking for the best way to resize uploaded images.
>> I'm already so far that I can upload/delete/update my images and show them
>> in my view. Now I want to resize the images for my view and thought about
>> the best way?
>>
>> First question: Is it possible to resize the images on the fly? For
>> example I uploaded an image in 1920x1080px and now want to transform it to
>> 400x200 or something similar when the view is being loaded? Is this a
>> convenient way in django or not?
>>
>> The only other way in my opinion could be to resize the image during the
>> file is being uploaded. What I don't like about this is that I have more
>> than one copy of one image only because of different image sizes.
>>
>> Any other thoughs?
>>
>> I know that there are some nice packages out there where such problems are
>> already solved. But since I'm new to django I want to learn by myself how to
>> accomplish the basic stufff :)
>>
>> Thanks in advance
>>
>> Regards nymo
>
> --
> 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 post to this group, send email to django-users@googlegroups.com.
> Visit this group at http://groups.google.com/group/django-users?hl=en.
> For more options, visit https://groups.google.com/groups/opt_out.
>
>

-- 
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 post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.




Re: On the fly image resize

2013-02-03 Thread Spencer Summerville
Hello, there are a lot of solutions to resizing images in Django. I commend 
you for wanting to create your own solution, but one of the greatest things 
about Django is that there's tons of projects that people have made that 
solve your problems and usually there's enough of them that you can find 
one that implements itself in a way that lets you do what you want to do. 
I'm not a great programmer and usually these modules are taken from 
websites that in order to function, they have had to work properly in an 
environment where anything can go wrong.

In my own experience, sorl-thumbnail has never let gotten in my way, it 
lets you do what you want and if you want to do something special you can 
easily write your own functionality. Don't want to use PIL? Use ImageMagick 
or write your own class. Have some sort of radical key value cache that 
nobody has ever heard of? Write your own class. Do you want to generate 
thumbnails in a batch process or in the model or in the template? 
sorl-thumbnail lets you choose what you want to do.

https://github.com/sorl/sorl-thumbnail

On Saturday, February 2, 2013 12:33:36 PM UTC-8, nYmo wrote:
>
> Hi all, 
> I'm new to django and also python but have already some programming 
> experience. I'm currently creating my first application in django and get 
> stucked because I'm looking for the best way to resize uploaded images.
> I'm already so far that I can upload/delete/update my images and show them 
> in my view. Now I want to resize the images for my view and thought about 
> the best way?
>
> First question: Is it possible to resize the images on the fly? For 
> example I uploaded an image in 1920x1080px and now want to transform it to 
> 400x200 or something similar when the view is being loaded? Is this a 
> convenient way in django or not?
>
> The only other way in my opinion could be to resize the image during the 
> file is being uploaded. What I don't like about this is that I have more 
> than one copy of one image only because of different image sizes. 
>
> Any other thoughs?
>
> I know that there are some nice packages out there where such problems are 
> already solved. But since I'm new to django I want to learn by myself how 
> to accomplish the basic stufff :) 
>
> Thanks in advance
>
> Regards nymo
>

-- 
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 post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.




Appscale and Django

2013-02-03 Thread hinnack
Hi all,

is someone on the list using Appscale [1] with Django?
If yes, what is your setup (MySQL, Mongo, E2, Eucalyptus [2], KVM, etc.)
What is your experiance towards stalability, reliability and performance?

[1] http://appscale.cs.ucsb.edu
[2] http://www.eucalyptus.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 post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.




Re: search across models

2013-02-03 Thread Ashwin Kumar
thank you dennis,

what you suggested is a difficult process where we need to look into
performance its the query gets more complex and database gets bigger which
is obvious.

but its a good idea. i will try that for a while.

With Best
-Ashwin.
+91-9959166266


On Sun, Feb 3, 2013 at 11:54 PM, Dennis Lee Bieber wrote:

> On Sun, 3 Feb 2013 13:11:55 +0530, Ashwin Kumar 
> declaimed the following in gmane.comp.python.django.user:
>
> > thank you joey,
> >
> > but i want to build search for queries like
> >
> >
> >1. restaurants in city1
> >2. city1 restaurants
> >3. Chinese restaurants
> >4. Chinese restaurants in city1
> >5. vegetarian restaurants in city1
> >6. vegetarian american restaurants
> >
> > the above are exact search queries we get from template.
> > i wrote
> > restas = restaurant.objects.filter(Q(name__contains =
> > request.REQUEST.get('title')) & ~Q(city__name='') )
> > this works fine to search with restaurant name.
> >
> >  i really have no idea on how to get results if the search phrase is
> > complex.
> >
> I've not been following, and don't know the schema, but for such
> searches I suspect you'll have to bypass Django's ORM and go to direct
> SQL...
>
> You'd split the search on words, skip the noise terms ("in", "and",
> "the", etc.), and then create a select statement in which you've created
> a test for each remaining word:
>
> select ... from ...
> where field contains  and field contains  and ...
>
> If you have two (or more) fields that need to be matched, it gets
> more complex (unless you build a separate index containing terms from
> all relevant fields).
> --
> Wulfraed Dennis Lee Bieber AF6VN
> wlfr...@ix.netcom.comHTTP://wlfraed.home.netcom.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 post to this group, send email to django-users@googlegroups.com.
> Visit this group at http://groups.google.com/group/django-users?hl=en.
> For more options, visit https://groups.google.com/groups/opt_out.
>
>
>

-- 
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 post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.




Re: How is fatcow for django hosting?

2013-02-03 Thread Gladson Simplício Brito
https://www.digitalocean.com


2013/2/3 Ashwin Kumar 

> i use amazon. its easy, fast, cheap, with full controll.
>
> this month my bill is 0$ as its free for 1yr
>
> With Best
> -Ashwin.
> +91-9959166266
>
>
> On Sat, Feb 2, 2013 at 11:16 AM, Mike  wrote:
>
>> I have been shopping for hosting for my project too (in my case a hobby
>> project that I will monetize ).  I don't know anything about Fat Cow but
>> many hosts will give you shell access and let you host django powered
>> sites.  What most won't do is let you run long running background processes
>> such as celery queues.  For my project I might be able to get by for a
>> while by running the background process with cron.  If that's the case for
>> you then make sure your host gives you access to cron.  I'd be interested
>> to know if anyone else is using shared hosting for their Django projects.
>>  I can afford to get a VPS but I don't want to admin my own server
>> unless/until its really necessary.  Now I'm using A Small Orange. Great
>> support.
>>
>> --
>> 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 post to this group, send email to django-users@googlegroups.com.
>> Visit this group at http://groups.google.com/group/django-users?hl=en.
>> For more options, visit https://groups.google.com/groups/opt_out.
>>
>>
>>
>  --
> 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 post to this group, send email to django-users@googlegroups.com.
> Visit this group at http://groups.google.com/group/django-users?hl=en.
> For more options, visit https://groups.google.com/groups/opt_out.
>
>
>

-- 
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 post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.




Help - No module named models

2013-02-03 Thread frocco
Hello,

In my settings.py
import django.conf.global_settings as DEFAULT_SETTINGS
TEMPLATE_CONTEXT_PROCESSORS = DEFAULT_SETTINGS.TEMPLATE_CONTEXT_PROCESSORS 
+ (
'utils.context_processors.eStore',
)

in my utils directory I have a context_processors.py
from django.conf import settings
from catalog.models import Category
from django.shortcuts import RequestContext
from cart import shoppingcart

def eStore(request):
return { ... }


ImproperlyConfigured at /

Error importing request processor module utils.context_processors: "No module 
named models"

Request Method:GETRequest URL:http://127.0.0.1:8000/Django 
Version:1.4.3Exception 
Type:ImproperlyConfiguredException Value:

Error importing request processor module utils.context_processors: "No module 
named models"

Exception Location:/Library/Python/2.7/site-packages/django/template/context.py 
in get_standard_processors, line 151Python Executable:
/System/Library/Frameworks/Python.framework/Versions/2.7/Resources/Python.app/Contents/MacOS/Python

-- 
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 post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.




Re: On the fly image resize

2013-02-03 Thread nYmo
Thanks Kelly, this looks like what I was looking for. Will give it a 
try. So far my self implementation looks like this:


  def medium_image(self):
return self.get_cache_image_path((400, 400))

def small_image(self):
return self.get_cache_image_path((128, 128))

 def get_cache_image_path(self, size):
"""Create cached image file and return the path to this file"""
#split file path to list to separate folder and file
folder_file = self.image.__str__().split('/')
#get base filename with extension
file_name = folder_file.pop()

#get full folder name
folder_name = "/".join(folder_file)

#extract file extension from file name
extension = file_name[-3:]
#extract clean file name for cached file
cached_file_name = file_name[:-4]
#create unique cached file name from size
cached_file_name += "_%sx%s" % size
cached_file_name += ".%s" % extension

self.create_cached_image_file(cached_file_name, folder_name, size)

#return path to cached file
return settings.MEDIA_URL + folder_name + '/cache/' + 
cached_file_name


 def create_cached_image_file(self, cached_file, folder, cache_file_size):
"""Create cache folder and cache image file but only if they 
don't exist already"""

cached_folder = settings.MEDIA_ROOT + folder + "/cache/"
#if cached folder does not exist create it
if not os.path.isdir(cached_folder):
os.mkdir(cached_folder)

#if file does not exist already then create it
if not os.path.isfile(cached_folder + cached_file):
im = Image.open(self.image.path)
im.thumbnail(cache_file_size, Image.ANTIALIAS)
im.save(cached_folder + cached_file)

This is within my model and in my template I can call 
{{model.medium_image}} or {{model.small_image}}. Works so far but is not 
"DRY" and also still I create a copy of each uploaded image. Will now 
check sorl-thumbnail.




On 02/03/2013 05:49 PM, Kelly Nicholes wrote:
Check out sorl-thumbnail.  https://github.com/sorl/sorl-thumbnail . 
 This lets you specify the desired size in a template.and can deal 
with cropping.  It caches the results so it doesn't have to regenerate 
it each time.


On Saturday, February 2, 2013 1:33:36 PM UTC-7, nYmo wrote:

Hi all,
I'm new to django and also python but have already some
programming experience. I'm currently creating my first
application in django and get stucked because I'm looking for the
best way to resize uploaded images.
I'm already so far that I can upload/delete/update my images and
show them in my view. Now I want to resize the images for my view
and thought about the best way?

First question: Is it possible to resize the images on the fly?
For example I uploaded an image in 1920x1080px and now want to
transform it to 400x200 or something similar when the view is
being loaded? Is this a convenient way in django or not?

The only other way in my opinion could be to resize the image
during the file is being uploaded. What I don't like about this is
that I have more than one copy of one image only because of
different image sizes.

Any other thoughs?

I know that there are some nice packages out there where such
problems are already solved. But since I'm new to django I want to
learn by myself how to accomplish the basic stufff :)

Thanks in advance

Regards nymo

--
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 post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.




--
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 post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.




Re: On the fly image resize

2013-02-03 Thread Kelly Nicholes
Check out sorl-thumbnail.  https://github.com/sorl/sorl-thumbnail .  This 
lets you specify the desired size in a template.and can deal with cropping. 
 It caches the results so it doesn't have to regenerate it each time.

On Saturday, February 2, 2013 1:33:36 PM UTC-7, nYmo wrote:
>
> Hi all, 
> I'm new to django and also python but have already some programming 
> experience. I'm currently creating my first application in django and get 
> stucked because I'm looking for the best way to resize uploaded images.
> I'm already so far that I can upload/delete/update my images and show them 
> in my view. Now I want to resize the images for my view and thought about 
> the best way?
>
> First question: Is it possible to resize the images on the fly? For 
> example I uploaded an image in 1920x1080px and now want to transform it to 
> 400x200 or something similar when the view is being loaded? Is this a 
> convenient way in django or not?
>
> The only other way in my opinion could be to resize the image during the 
> file is being uploaded. What I don't like about this is that I have more 
> than one copy of one image only because of different image sizes. 
>
> Any other thoughs?
>
> I know that there are some nice packages out there where such problems are 
> already solved. But since I'm new to django I want to learn by myself how 
> to accomplish the basic stufff :) 
>
> Thanks in advance
>
> Regards nymo
>

-- 
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 post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.




django setup advice for AWS Elastic Beanstalk

2013-02-03 Thread Phil
Hi,

I am following the steps here to setup django on aws...
http://docs.aws.amazon.com/elasticbeanstalk/latest/dg/create_deploy_Python_django.html

I got as far as step 6 but when I "git aws.push" I never see the django "it 
worked" page, only the green beanstalk page. I'm sure where I've gone wrong 
is where Ive placed particular files/ folders so was just looking for some 
advice/ clarification on where everything should be.

So I created my virtualenv("~/web/mysiteenv/"), activate it, pip installs 
etc. From inside that folder I create my djangoproject("mysite"). So the 
files/ folders I'm unsure about are the following:


   1. I run "git init" from "~/web/mysiteenv/mysite"
   2. Where should beanstalk folder("AWS-ElasticBeanstalk-CLI-2.2") be? I 
   had it at "~/web/mysiteenv"
   3. I run "eb start" from "~/web/mysiteenv/mysite"
   4. Where should I run "mkdir .ebextensions", I ran it inside 
   "~/web/mysiteenv/mysite" I put the config file in the ".ebextensions" 
   folder.

If anyone can see where I've gone wrong I would be very grateful to you. 
I've deleted the project so I can start over. 








-- 
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 post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.




Re: Update / collectstatic / loadfixtures automation

2013-02-03 Thread Thiago Carvalho D' Ávila
Yeah, it worked =)
I tryed --noinput before but the behavior is a little different.
Thanks!



2013/2/3 John 

>  I do
>
> echo yes | ./manage.py collectstatic
>
> which I'm sure you can adapt for your script.
>
> John
>
>
> On 03/02/13 16:02, Thiago Carvalho D' Ávila wrote:
>
>  Hello, I made a little script for automation for when I update my site
> on production, it is like:
>
>   update.sh 
> echo "Connecting"
> ssh -t -t prefix.myserver.com -lusername < echo "Activating the virtual environment..."
> source ~/env/bin/activate
> echo "Updating project from SVN..."
> cd projectname
> svn update
> #echo "Collecting static files"
> #PYTHONPATH=~/env/src/django python manage.py collectstatic
> echo "Syncing DB"
> PYTHONPATH=~/env/src/django python manage.py syncdb
> PYTHONPATH=~/env/src/django python manage.py loaddata
> people/fixtures/groups.yaml
> PYTHONPATH=~/env/src/django python manage.py loaddata
> people/fixtures/person.yaml
> PYTHONPATH=~/env/src/django python manage.py loaddata
> people/fixtures/sites.yaml
> ~/init/projectname restart
> exit
> END_SCRIPT
> echo "Done"
>   end update.sh 
>
>  The problem is that, if I uncomment the collectstatic line, it pops the
> message:
> "This will overwrite existing files!
> Are you sure you want to do this?
>
> Type 'yes' to continue, or 'no' to cancel:"
>
>  When I answer yes, the script stops... is it possible to make it say yes
> by default?
>
> Thanks!
>   --
> 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 post to this group, send email to django-users@googlegroups.com.
> Visit this group at http://groups.google.com/group/django-users?hl=en.
> For more options, visit https://groups.google.com/groups/opt_out.
>
>
>
>
>  --
> 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 post to this group, send email to django-users@googlegroups.com.
> Visit this group at http://groups.google.com/group/django-users?hl=en.
> For more options, visit https://groups.google.com/groups/opt_out.
>
>
>

-- 
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 post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.




Re: Update / collectstatic / loadfixtures automation

2013-02-03 Thread John
I do

echo yes | ./manage.py collectstatic

which I'm sure you can adapt for your script.

John

On 03/02/13 16:02, Thiago Carvalho D' Ávila wrote:
> Hello, I made a little script for automation for when I update my site
> on production, it is like:
>
>  update.sh 
> echo "Connecting"
> ssh -t -t prefix.myserver.com  -lusername
> < echo "Activating the virtual environment..."
> source ~/env/bin/activate
> echo "Updating project from SVN..."
> cd projectname
> svn update
> #echo "Collecting static files"
> #PYTHONPATH=~/env/src/django python manage.py collectstatic
> echo "Syncing DB"
> PYTHONPATH=~/env/src/django python manage.py syncdb
> PYTHONPATH=~/env/src/django python manage.py loaddata
> people/fixtures/groups.yaml
> PYTHONPATH=~/env/src/django python manage.py loaddata
> people/fixtures/person.yaml
> PYTHONPATH=~/env/src/django python manage.py loaddata
> people/fixtures/sites.yaml
> ~/init/projectname restart
> exit
> END_SCRIPT
> echo "Done"
>  end update.sh 
>
> The problem is that, if I uncomment the collectstatic line, it pops
> the message:
> "This will overwrite existing files!
> Are you sure you want to do this?
>
> Type 'yes' to continue, or 'no' to cancel:"
>
> When I answer yes, the script stops... is it possible to make it say
> yes by default?
>
> Thanks!
> -- 
> 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 post to this group, send email to django-users@googlegroups.com.
> Visit this group at http://groups.google.com/group/django-users?hl=en.
> For more options, visit https://groups.google.com/groups/opt_out.
>  
>  

-- 
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 post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.




Update / collectstatic / loadfixtures automation

2013-02-03 Thread Thiago Carvalho D' Ávila
Hello, I made a little script for automation for when I update my site on
production, it is like:

 update.sh 
echo "Connecting"
ssh -t -t prefix.myserver.com -lusername 

Django Admin or Site from scratch

2013-02-03 Thread Yogesh Kamble


When to use Django Admin Interface and when to use our template for 
displaying data and playing with data? Suppose I want to create web site 
for Book Management and each user has their own set of book so for such 
application , should we use django admin or create our own site from 
scratch in django?

What steps we should follow to create web site from scratch ? or if we want 
to use django admin what is prerequisite to customize admin interface ?

-- 
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 post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.




Re: DateTimeField stored as None

2013-02-03 Thread Rootz
Changing pub_date to DateField() class worked now and now I am able to see 
date values stored in the pub_date column.

On Sunday, February 3, 2013 9:07:27 AM UTC-5, Rootz wrote:
>
> I made several attempts to store/update the current date in a model. I 
> used both admin page and the shell  to save/update a datetimefield value of 
> my model and then after querying the record it return None for 
> datetimefield column.
>
> Secondly my method was_published_recently() does not work.
>
> I am guessing maybe its because I am using sqlite3 correct me if I am 
> wrong?
>
> I am using sqlite3 db engine.
>
> models.py  
>
> from django.db import models
> import datetime
> from django.utils import timezone
>
>
> # Create your models here.
>
> class Poll(models.Model):
> question = models.CharField(max_length=200)
> pub_date = models.DateTimeField('Date Information')
>
> def __unicode__(self):
> return self.question
>
> def was_published_recently(self):
> return self.pub_date >= timezone.now() - datetime.timedelta(days=1)
>
> class Choice(models.Model):
> poll = models.ForeignKey('Poll')
> choice = models.CharField(max_length=200)
> votes = models.IntegerField()
>
> def __unicode__(self):
> return self.choice
>
>
>
>

-- 
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 post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.




DateTimeField stored as None

2013-02-03 Thread Rootz
I made several attempts to store/update the current date in a model. I used 
both admin page and the shell  to save/update a datetimefield value of my 
model and then after querying the record it return None for datetimefield 
column.

Secondly my method was_published_recently() does not work.

I am guessing maybe its because I am using sqlite3 correct me if I am wrong?

I am using sqlite3 db engine.

models.py  

from django.db import models
import datetime
from django.utils import timezone


# Create your models here.

class Poll(models.Model):
question = models.CharField(max_length=200)
pub_date = models.DateTimeField('Date Information')

def __unicode__(self):
return self.question

def was_published_recently(self):
return self.pub_date >= timezone.now() - datetime.timedelta(days=1)

class Choice(models.Model):
poll = models.ForeignKey('Poll')
choice = models.CharField(max_length=200)
votes = models.IntegerField()

def __unicode__(self):
return self.choice



-- 
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 post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.




Re: On the fly image resize

2013-02-03 Thread nYmo
Thanks to all of you for your thoughs on this. I think I will try to 
build my own solution based on PIL. And then check out a already 
developed plugin and try to improve my own solution.



On 02/03/2013 07:43 AM, mulianto wrote:

hi

you can use pil , python image lib if you take make your own solution.

if want faster solution use other app that do it for you.

you can learn from others source code also and creAte your own solution.



Sent from my iPhone

On 3 Feb 2013, at 04:33, nYmo > wrote:



Hi all,
I'm new to django and also python but have already some programming 
experience. I'm currently creating my first application in django and 
get stucked because I'm looking for the best way to resize uploaded 
images.
I'm already so far that I can upload/delete/update my images and show 
them in my view. Now I want to resize the images for my view and 
thought about the best way?


First question: Is it possible to resize the images on the fly? For 
example I uploaded an image in 1920x1080px and now want to transform 
it to 400x200 or something similar when the view is being loaded? Is 
this a convenient way in django or not?


The only other way in my opinion could be to resize the image during 
the file is being uploaded. What I don't like about this is that I 
have more than one copy of one image only because of different image 
sizes.


Any other thoughs?

I know that there are some nice packages out there where such 
problems are already solved. But since I'm new to django I want to 
learn by myself how to accomplish the basic stufff :)


Thanks in advance

Regards nymo
--
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 post to this group, send email to django-users@googlegroups.com 
.

Visit this group at http://groups.google.com/group/django-users?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.



--
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 post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.




--
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 post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.




Re: Automating deployments

2013-02-03 Thread Sanjay Bhangar
On Sun, Feb 3, 2013 at 1:32 PM, Ashwin Kumar  wrote:
> thats so kind of you, i struggled a lot for 1 month to setup a server
> (ubuntu+nginx+uWSGI+mysql+pil+virtualenv+emperor).
> still i didn't succeed running emepror on system restart, i removed
> virtualenv as i got python-mysqldb error.
>

for the python-mysqldb error, here is what I generally do:
install python-mysqldb from apt-get, so 'sudo apt-get install python-mysqldb'
and then when creating the virtualenv, make sure to tell it to use
system packages where available with:
virtualenv --system-site-packages .

Then it should use mysqldb from the one installed by apt, which should
generally work better with the version, etc. on your machine than the
one installed from pip.

Hope that helps,
Sanjay


> let me know if you finish it.
>
> With Best
> -Ashwin.
> +91-9959166266
>
>
> On Sat, Feb 2, 2013 at 6:23 AM, Brian Schott  wrote:
>>
>> We are using ansible.
>> http://ansible.cc/
>>
>> Other popular choices are puppet and chef.  The real benefit. Is that
>> these tools let you version control your configurations.
>>
>> Sent from my iPhone
>>
>> On Feb 1, 2013, at 7:46 PM, Carlos Aguilar  wrote:
>>
>> Bash scripts really???
>>
>> If you are a Python developer you can use fabric to deployed and pip for
>> dependencies.
>>
>> Best Regards
>>
>> El viernes, 1 de febrero de 2013, Marc Aymerich escribió:
>>>
>>> Hi,
>>> I'm thinking about the best way to provide automatic deployment for
>>> the Django project I'm working on. Its a pretty big one and has lots
>>> of dependencies, lots of SO packages, Celeryd and other daemons, SO
>>> tweaks... and also several people will need to have installed it on
>>> their servers (they are sysadmins, not Django developers), Therefore I
>>> want to automate as much as possible the installation and updating
>>> processes, to minimize their pain and also because of having
>>> homogeneity.
>>>
>>> As I've been a sysadmin myself for many years I've already written
>>> some bash scripts that automates all the deployment. But in order to
>>> make it more 'natural' I'm planning to integrate those scripts within
>>> the Django project as management commands.
>>>
>>> To illustrate my ultimate goal this is how I imagine the workflow:
>>>
>>> sudo pip install django-my_project
>>> my_project-admin.sh clone project_name path
>>>
>>> sudo python manage.py installrequirements
>>> sudo python manage.py setuppostgres
>>> python manage.py syncdb
>>> python manage.py migrate
>>> python manage.py createsuperuser
>>>
>>> sudo python manage.py setupapache
>>> python manage.py collectstatic
>>> sudo python manage.py setupceleryd
>>> sudo python manage.py createtincserver
>>> python manage.py updatetincd
>>> sudo python manage.py setupfirmware
>>> python manage.py loaddata firmwareconfig
>>>
>>> sudo python manage.py restartservices
>>>
>>>
>>> Any thought on this? How do you automate your deployments? I heard
>>> about fabric lots of times but never used it. Will fabric be helpful
>>> in my case? Does it has any advantage for writing my own scripts? Or
>>> maybe there are already some existing tools for automating deployment
>>> of most common services like Apache, celeryd ..,?
>>>
>>> Many thanks!
>>> br
>>> --
>>> Marc
>>>
>>> --
>>> 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 post to this group, send email to django-users@googlegroups.com.
>>> Visit this group at http://groups.google.com/group/django-users?hl=en.
>>> For more options, visit https://groups.google.com/groups/opt_out.
>>>
>>>
>>
>>
>> --
>> Carlos Aguilar
>> Consultor Hardware y Software
>> DWD
>> http://www.dwdandsolutions.com
>> http://www.houseofsysadmin.com
>> Cel: +50378735118
>> USA: (301) 337-8541
>>
>> --
>> 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 post to this group, send email to django-users@googlegroups.com.
>> Visit this group at http://groups.google.com/group/django-users?hl=en.
>> For more options, visit https://groups.google.com/groups/opt_out.
>>
>>
>>
>> --
>> 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 post to this group, send email to django-users@googlegroups.com.
>> Visit this group at http://groups.google.com/group/django-users?hl=en.
>> For more options, visit https://groups.google.com/groups/opt_out.
>>
>>
>
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" 

Re: How is fatcow for django hosting?

2013-02-03 Thread Ashwin Kumar
i use amazon. its easy, fast, cheap, with full controll.

this month my bill is 0$ as its free for 1yr

With Best
-Ashwin.
+91-9959166266


On Sat, Feb 2, 2013 at 11:16 AM, Mike  wrote:

> I have been shopping for hosting for my project too (in my case a hobby
> project that I will monetize ).  I don't know anything about Fat Cow but
> many hosts will give you shell access and let you host django powered
> sites.  What most won't do is let you run long running background processes
> such as celery queues.  For my project I might be able to get by for a
> while by running the background process with cron.  If that's the case for
> you then make sure your host gives you access to cron.  I'd be interested
> to know if anyone else is using shared hosting for their Django projects.
>  I can afford to get a VPS but I don't want to admin my own server
> unless/until its really necessary.  Now I'm using A Small Orange. Great
> support.
>
> --
> 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 post to this group, send email to django-users@googlegroups.com.
> Visit this group at http://groups.google.com/group/django-users?hl=en.
> For more options, visit https://groups.google.com/groups/opt_out.
>
>
>

-- 
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 post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.




Re: Automating deployments

2013-02-03 Thread Ashwin Kumar
thats so kind of you, i struggled a lot for 1 month to setup a server
(ubuntu+nginx+uWSGI+mysql+pil+virtualenv+emperor).
still i didn't succeed running emepror on system restart, i removed
virtualenv as i got python-mysqldb error.

let me know if you finish it.

With Best
-Ashwin.
+91-9959166266


On Sat, Feb 2, 2013 at 6:23 AM, Brian Schott  wrote:

> We are using ansible.
> http://ansible.cc/
>
> Other popular choices are puppet and chef.  The real benefit. Is that
> these tools let you version control your configurations.
>
> Sent from my iPhone
>
> On Feb 1, 2013, at 7:46 PM, Carlos Aguilar  wrote:
>
>  Bash scripts really???
>
> If you are a Python developer you can use fabric to deployed and pip for
> dependencies.
>
> Best Regards
>
> El viernes, 1 de febrero de 2013, Marc Aymerich escribió:
>
>> Hi,
>> I'm thinking about the best way to provide automatic deployment for
>> the Django project I'm working on. Its a pretty big one and has lots
>> of dependencies, lots of SO packages, Celeryd and other daemons, SO
>> tweaks... and also several people will need to have installed it on
>> their servers (they are sysadmins, not Django developers), Therefore I
>> want to automate as much as possible the installation and updating
>> processes, to minimize their pain and also because of having
>> homogeneity.
>>
>> As I've been a sysadmin myself for many years I've already written
>> some bash scripts that automates all the deployment. But in order to
>> make it more 'natural' I'm planning to integrate those scripts within
>> the Django project as management commands.
>>
>> To illustrate my ultimate goal this is how I imagine the workflow:
>>
>> sudo pip install django-my_project
>> my_project-admin.sh clone project_name path
>>
>> sudo python manage.py installrequirements
>> sudo python manage.py setuppostgres
>> python manage.py syncdb
>> python manage.py migrate
>> python manage.py createsuperuser
>>
>> sudo python manage.py setupapache
>> python manage.py collectstatic
>> sudo python manage.py setupceleryd
>> sudo python manage.py createtincserver
>> python manage.py updatetincd
>> sudo python manage.py setupfirmware
>> python manage.py loaddata firmwareconfig
>>
>> sudo python manage.py restartservices
>>
>>
>> Any thought on this? How do you automate your deployments? I heard
>> about fabric lots of times but never used it. Will fabric be helpful
>> in my case? Does it has any advantage for writing my own scripts? Or
>> maybe there are already some existing tools for automating deployment
>> of most common services like Apache, celeryd ..,?
>>
>> Many thanks!
>> br
>> --
>> Marc
>>
>> --
>> 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 post to this group, send email to django-users@googlegroups.com.
>> Visit this group at http://groups.google.com/group/django-users?hl=en.
>> For more options, visit https://groups.google.com/groups/opt_out.
>>
>>
>>
>
> --
> Carlos Aguilar
> Consultor Hardware y Software
> DWD
> http://www.dwdandsolutions.com
> http://www.houseofsysadmin.com
> Cel: +50378735118
> USA: (301) 337-8541
>
>  --
> 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 post to this group, send email to django-users@googlegroups.com.
> Visit this group at http://groups.google.com/group/django-users?hl=en.
> For more options, visit https://groups.google.com/groups/opt_out.
>
>
>
>  --
> 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 post to this group, send email to django-users@googlegroups.com.
> Visit this group at http://groups.google.com/group/django-users?hl=en.
> For more options, visit https://groups.google.com/groups/opt_out.
>
>
>

-- 
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 post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.