manipulating images

2006-06-20 Thread Sasha
Hello, I'd like to create a thumbnail for an image after it has been uploaded. I have seen two possible approaches descibed here - subclassing ImageField and overriding the save() method of the model. Although the former seems more elegant, the latter seems like less work and I'm inclined to try

Re: FileField - my variable used in "upload_to" parameter

2006-06-20 Thread mwtb
[EMAIL PROTECTED] wrote: > Hi! > > Is there way to change "upload_to" parameter's behaviour? > I see there is hardcoded strftime replacement. > > What I want to achieve is to organise uploaded files with directories > named with uploading user's name. eg. MEDIA_ROOT/uploads// > Jay's patch is c

Re: manipulating images

2006-06-20 Thread mwtb
Sasha wrote: > Hello, > > I'd like to create a thumbnail for an image after it has been uploaded. > I have seen two possible approaches descibed here - subclassing > ImageField and overriding the save() method of the model. Although the > former seems more elegant, the latter seems like less work

Re: manipulating images

2006-06-20 Thread Sasha
hey damian, thanks for replying. i'd like to save the thumbnail into a separate field. i just found the save_fieldname_file() method using the shell. so my model looks like this: class Picture(models.Model): image = models.ImageField(upload_to="uploads", blank=True) thumbnail = m

Re: Form from multiple models

2006-06-20 Thread James Mulholland
Thanks :-) I'll take a look at those resources. --~--~-~--~~~---~--~~ 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

Re: manipulating images

2006-06-20 Thread mwtb
Sasha wrote: > def save(self): > super(Picture, self).save() > if self.image and not self.thumbnail: > import Image > myImage = Image.open(self.get_image_filename()) > myImage.thumbnail((150,150))

Re: manipulating images

2006-06-20 Thread Phil Powell
It might be worth you taking a look at the work done on Thumbnails in DjangoUtils: http://djangoutils.python-hosting.com/wiki/Thumbnails Although not a solid chunk of code (there are a few issues with namespaces, and it uses some Python 2.4 specific stuff), but with a bit of hacking I got automa

Re: Cutting output of flup's FastCGI server

2006-06-20 Thread Gábor Farkas
PythonistL wrote: > Hello Ivan, > It is intereresting. > But why do you use/prefer FastCGI to mod_python ? > I am asking because I used for my Django apps FastCGI with Dreamhost > but a lot of problems - Apache server used to hang when there were a > lot of visitors. Now I switched to mod_python a

Problem with _post_save() on 0.9.1

2006-06-20 Thread David Reynolds
Hi, I hope someone is still using 0.9.1, as I am having a small problem with using _post_save() in a model on it. I am creating a newsletter type system, which has various ForeignKey fields. When the _post_save hook is called the email is sent, however when I change the email and store it,

Re: Problem with _post_save() on 0.9.1 - Addendum

2006-06-20 Thread David Reynolds
On 20 Jun 2006, at 11:25 am, David Reynolds wrote: > I hope someone is still using 0.9.1, as I am having a small problem > with using _post_save() in a model on it. > > I am creating a newsletter type system, which has various ForeignKey > fields. When the _post_save hook is called the email is

Re: Announcing Tabblo, a Django app

2006-06-20 Thread Ned Batchelder
We got a little more traffic, but not much, because it was a secondary mention, rather than the main story.  We're expecting a bigger hit later this week, though, so we're preparing... --Ned. wiz wrote: On 5/18/06, Ned Batchelder <[EMAIL PROTECTED]> wrote: Hey all, We've just

Re: Reference Data Values

2006-06-20 Thread Frédéric Roland
It seems that what I want to achieve can be done using "choices" as seen here: http://www.djangoproject.com/documentation/model_api/#choices I think that I will define the three tables I use (reference_data_domains, reference_data_values, reference_data_links) in a model and make a function re

Re: Please Help with Template for django.views.generic.create_update.update_object

2006-06-20 Thread Paul Childs
Honest, I really tried to figure this out on my own. I have been relying on the Django website for answers but template examples are in really short supply. I'd even accept a search string for Google if that's all anyone is willing to give. Thanks in advance. --~--~-~--~~---

Using offset and limit to produce a blog archive

2006-06-20 Thread [EMAIL PROTECTED]
Hi All, I'm in the process of learning Django by example - creating a blog application. SO, I have my blog up and running using the date based generics but would like to limit the number of posts that appear in the main archive (/path/to/site/blog/) to 10, which i've done in the urls.py like so:

Re: Please Help with Template for django.views.generic.create_update.update_object

2006-06-20 Thread Paul Childs
I received an email from someone in the group for more clarification: > But then, why do you want to put more than one image in a form? There can be more than one photograph of each repair. I need to mirror what is done in the admin with models that are edited inline. > What is the form for? wh

Which IDE to debug django app? (Was "Using Pyscripter with Django")

2006-06-20 Thread Filipe
Hi, Frankie Robertson wrote: > In general I find it to be quicker to > have a quick read of the documentation, or, as a last resort, ask on > IRC than to debug when using django yeah, but nothing can really replace a debugger for err.. debugging :) specially when it comes to solving problems tha

Re: Using offset and limit to produce a blog archive

2006-06-20 Thread Scott Anderson
You should find what you're looking for here: http://www.djangoproject.com/documentation/url_dispatch/#example Regards, -scott On Tue, 2006-06-20 at 12:18 +, [EMAIL PROTECTED] wrote: > Hi All, > > I'm in the process of learning Django by example - creating a blog > application. > SO, I h

Re: Which IDE to debug django app? (Was "Using Pyscripter with Django")

2006-06-20 Thread Josh Trutwin
On Tue, 20 Jun 2006 13:01:31 - "Filipe" <[EMAIL PROTECTED]> wrote: > Rephrasing my initial question a bit, can someone advise me on an > IDE in which to build a django app that will allow me to > "graphically" use a debugger? (ie, place breakpoints, inspect > values in vars, see the current

Re: Having many of one application.

2006-06-20 Thread Jay Parlar
And if you really need per-object permissions, you can use the new GenericRelations recently checked in by Jacob. Ian has a nice post about it here http://feh.holsman.net/articles/2006/06/19/django-generic-relations, which includes all the relevant links. I was able to get a per-object permissio

Re: Which IDE to debug django app? (Was "Using Pyscripter with Django")

2006-06-20 Thread mamcxyz
I work fine with Komodo 3.5 Personal. I follow this way: http://groups.google.com/group/django-users/browse_thread/thread/46e2fe7895565c5b/8558ac68f9461710?q=komodo+&rnum=3#8558ac68f9461710 --~--~-~--~~~---~--~~ You received this message because you are subscrib

Template variables

2006-06-20 Thread Patrick
Hi i'm newbie and i want to publish my Django website. I have this "stupid" problem. I have a tab bar like this: Home^M Blog^M Tags^M Blank^M

MS SQL Django suport is stable?

2006-06-20 Thread mamcxyz
Is MSSQL support good for a production site? --~--~-~--~~~---~--~~ 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, s

Re: Which IDE to debug django app? (Was "Using Pyscripter with Django")

2006-06-20 Thread Michael Radziej
Hi, I really found I don't need a debugger for Django. If I have a problem, I set some random variable to the data I am interested in and raise a non-existing exception, like: bla = user.__dict__ raise Bla Then I deal with my browser, and the (great!) error page of Django will tell me all I

Re: MS SQL Django suport is stable?

2006-06-20 Thread Adrian Holovaty
On 6/20/06, mamcxyz <[EMAIL PROTECTED]> wrote: > Is MSSQL support good for a production site? No. I haven't heard from anybody who's actually using it, and I can't test because I don't run WIndows. Adrian -- Adrian Holovaty holovaty.com | djangoproject.com --~--~-~--~~

Re: Template variables

2006-06-20 Thread Wilson Miner
Hi Patrick, You might find some helpful responses in this thread: http://groups.google.com/group/django-users/browse_frm/thread/50ee1c147854769/a79890af3059229d?q=menu&rnum=3#a79890af3059229d On 6/20/06, Patrick <[EMAIL PROTECTED]> wrote: > > Hi i'm newbie and i want to publish my Django websit

Re: MS SQL Django suport is stable?

2006-06-20 Thread Jeremy Dunck
On 6/20/06, mamcxyz <[EMAIL PROTECTED]> wrote: > > Is MSSQL support good for a production site? > No, definitely not. :-/ There are 2 libs for SQL Server access (that I know of). adodbapi, which is windows-only, a

Re: custom form view not keeping information

2006-06-20 Thread Jorge Gajon
Hi, Why don't you post some code to see if we can understand better your problem and what modifications could be done? On 6/19/06, hotani <[EMAIL PROTECTED]> wrote: > > I'm pretty much giving up on this -- unless i find an alternative, I'm > going to end up using hidden fields with the generic

overriding-default-model-methods what am i doing wrong ?

2006-06-20 Thread coulix
hello, simple problem : class Tag(models.Model): name = models.CharField(maxlength=200, core=True) total_ref = models.IntegerField(blank=True, null=True) class Admin: ordering = ['name'] def __str__(self): return self.name def get_absolute_url(self):

where to run extra SQL when "manage.py reset appname" is run

2006-06-20 Thread Ronny Srnka
hi! i've discovered django a few days ago and i must say it looks very useful and decided to use it for my latest project. i might ask some simple questions cause this is new to me, but am going over the documentation (and google) before asking. anyways done to business: i'd like to use some

Data Modeling Question

2006-06-20 Thread Sandro
I've got a csv file filled with directory paths, users and their permissions... I have a database for paths and users I need to go to every path and find which user has what permissions for that path. do I need to make a class Web_Permission(models.Model): path = models.ForeignKey(Web_Path)

Re: custom form view not keeping information

2006-06-20 Thread hotani
I'm on another machine without my code readily available - so let me attempt to rephrase one of the problems i'm having with generic updates: if there is a model with 10 fields, and an existing object which I'm editing in a generic view, but only editing 2 of the 10 fields, it is attempting to re

Re: where to run extra SQL when "manage.py reset appname" is run

2006-06-20 Thread Adrian Holovaty
On 6/20/06, Ronny Srnka <[EMAIL PROTECTED]> wrote: > i'd like to use some triggers to increment and decrement fields in the db. > i've written them up but would like to know if there is somewhere to run > them when i reset (or the initial syncdb on) an app with manage.py? > i saw that django.core.

Re: Problem with overriding save() and related objects

2006-06-20 Thread Derek Hoy
On 6/19/06, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: ... > Now, if I set up a join table (a DocumentRecipient model with Document > and Recipient as foreign keys) and override the DocumentRecipient > save() function to send the email, that works, but that seems like a > clunky way to do things

Keeping keys consistent while using manual and automatically populated models?

2006-06-20 Thread m h
Hey all- For my django app I'm generating a bit of the model using a script. The basic idea is that the script provides versioned data for components. As new versions of components are added over time the script needs to be re-run to add the data for the new versions. The end users are also abl

Re: MS SQL Django suport is stable?

2006-06-20 Thread mamcxyz
Ok. Thanks If some progress is made I'm can test it. So back to mysql :( --~--~-~--~~~---~--~~ 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 u

Re: Having many of one application.

2006-06-20 Thread djx
thanks heaps Nick and Jay. --~--~-~--~~~---~--~~ 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 [EMAI

Re: Problem with overriding save() and related objects

2006-06-20 Thread [EMAIL PROTECTED]
Thank you. I'll give that a try. --~--~-~--~~~---~--~~ 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 t

"Normalizing/cleaning" text of bad/unclosed tags?

2006-06-20 Thread Jay Parlar
Is there anything built into Django to cleanup text that a user might enter in a textfield/comment/etc., so that if I display that text field in a template, any unclosed tags in it won't screw up my page? Something like the 'striptags' filter, except instead of removing all tags, it just makes su

Re: "Normalizing/cleaning" text of bad/unclosed tags?

2006-06-20 Thread Jeremy Dunck
On 6/20/06, Jay Parlar <[EMAIL PROTECTED]> wrote: > > Is there anything built into Django to cleanup text that a user might > enter in a textfield/comment/etc., so that if I display that text > field in a template, any unclosed tags in it won't screw up my page? > > Something like the 'striptags'

Re: Please Help with Template for django.views.generic.create_update.update_object

2006-06-20 Thread Jay Parlar
You may just have a situation here that generic views can't handle, and you'll have to write your own view. If you grep through contrib.admin, you'll notice that they don't actually use any generic views there. That being said, it'd be nice if someone wrote a little tutorial on creating your own

Re: "Normalizing/cleaning" text of bad/unclosed tags?

2006-06-20 Thread Jay Parlar
On 6/20/06, Jeremy Dunck <[EMAIL PROTECTED]> wrote: > On the open web, you should never ever display text supplied by > regular users as HTML. Doing so allows them to wreck the page at best > and create security problems or denial of service at worst. > > That said, if you trust your users you mi

Re: "Normalizing/cleaning" text of bad/unclosed tags?

2006-06-20 Thread Jeremy Dunck
On 6/20/06, Jay Parlar <[EMAIL PROTECTED]> wrote: > How do sites like Fark.com that allow HTML do it? I guess they've just > written their own sanitizers. LiveJournal as a well-evolved HTML filter, but it's in perl. http://cvs.livejournal.org/browse.cgi/livejournal/cgi-bin/cleanhtml.pl (It seems

Re: "Normalizing/cleaning" text of bad/unclosed tags?

2006-06-20 Thread Jeremy Dunck
On 6/20/06, Jay Parlar <[EMAIL PROTECTED]> wrote: > Well, as it stands right now, I only need this to make sure that text > entered into the Admin is ok, and that's all by trusted users, so > Beautiful Soup might do it. Python wrappers for Tidy: http://utidylib.berlios.de/ >From the homepage: =

Re: "Normalizing/cleaning" text of bad/unclosed tags?

2006-06-20 Thread Jay Parlar
On 6/20/06, Jeremy Dunck <[EMAIL PROTECTED]> wrote: > LiveJournal as a well-evolved HTML filter, but it's in perl. > http://cvs.livejournal.org/browse.cgi/livejournal/cgi-bin/cleanhtml.pl > > (It seems like Python should have one, but I don't know of one.) Eww, I don't want HTML in comments enou

Re: "Normalizing/cleaning" text of bad/unclosed tags?

2006-06-20 Thread Ian Holsman
I avoid this issue by using a 'live preview' and let them use bbcode/ markup/textile only and stripping out ALL html. On 21/06/2006, at 9:28 AM, Jay Parlar wrote: > > On 6/20/06, Jeremy Dunck <[EMAIL PROTECTED]> wrote: > >> LiveJournal as a well-evolved HTML filter, but it's in perl. >> http:/

Custom tags installation

2006-06-20 Thread Nuno Mariz
Hi, I'm new to Python and Django, and i'm having some difficulties to understand some issues. I what to build a custom tag but can't deploy it, because I don't know where to put my Node module. In the documentation says how to build it, but not the deployment instructions(http://www.djangoproje

Re: Custom tags installation

2006-06-20 Thread Jay Parlar
On 6/20/06, Nuno Mariz <[EMAIL PROTECTED]> wrote: > > Hi, > I'm new to Python and Django, and i'm having some difficulties to > understand some issues. > I what to build a custom tag but can't deploy it, because I don't know > where to put my Node module. > In the documentation says how to build i

Re: Custom tags installation

2006-06-20 Thread Nuno Mariz
Sorry, Too many hours working ;) Jay Parlar wrote: > > Scroll up on that page a bit, and read "Extending the template > system". The deployment process is described there. > > Jay P. --~--~-~--~~~---~--~~ You received this message because you are subscribed to

Re: Please Help with Template for django.views.generic.create_update.update_object

2006-06-20 Thread Malcolm Tredinnick
On Mon, 2006-06-19 at 16:42 +, Paul Childs wrote: > I am using the Dev trunk as of Saturday with the models below: > > #-- > class Repair(models.Model): > > tail_number = models.IntegerField(choices=AIRCRAFT_CHOICES) > > location = models.CharField(ma

Re: Cutting output of flup's FastCGI server

2006-06-20 Thread Ivan Sagalaev
PythonistL wrote: > Hello Ivan, > It is intereresting. > But why do you use/prefer FastCGI to mod_python ? I don't prefer it yet, just evaluating. I have some strange problems with server overloading doing about 30 parallel requests all of which sleep() about 90% of time. My first theory was t