seeking elegant solution to ordered list of installed applications

2009-03-23 Thread Michael Repucci
Hi All, I've got a Django project composed of several apps. The site's main page creates links from the list of installed apps like so: #taken from the project's urlconf apps = [app.split('.')[1] for app in settings.INSTALLED_APPS if app.startswith(#project name#)] info_dict = {'template': 'index

custom validation (clean_) based on image height and width

2009-03-19 Thread Michael Repucci
I'm struggling with what seems like should be a very straightforward task. I have a model with a field named image of type ImageField, and I'd like to do custom validation via the model form's clean_image method based on the height and width (in pixels) of the image. If I just grab the image obje

Re: problem with permission to delete objects with ManyToManyField relations

2009-03-13 Thread Michael Repucci
the url, so it's by far an ideal solution. Any other thoughts? On Mar 12, 4:09 pm, Michael Repucci wrote: > Hi Django'ers, > > I've got three models, call them A, B, and C. A contains a > ManyToManyField to model B. Users in my admin can add/change/delete B > and C b

problem with permission to delete objects with ManyToManyField relations

2009-03-12 Thread Michael Repucci
Hi Django'ers, I've got three models, call them A, B, and C. A contains a ManyToManyField to model B. Users in my admin can add/change/delete B and C but not A. When users delete C, there is no problem. However, when users attempt to delete B, permission is denied due to the relation to A, which

Re: problem uploading favicon.ico to an ImageField field

2009-03-10 Thread Michael Repucci
Actually, sorry, this works fine with ico files created at http://www.favicon.cc/, just not with those created from an image at http://www.html-kit.com/favicon/. So nevermind I guess. On Mar 10, 1:10 pm, Michael Repucci wrote: > Hi Django'ers, > > I get a strange bug, which

problem uploading favicon.ico to an ImageField field

2009-03-10 Thread Michael Repucci
Hi Django'ers, I get a strange bug, which seems to be a problem/conflict between PIL (Python Imaging Library) and the ImageField model field. I have a standard ImageField, but when a user tries to upload an ico file (created either at http://www.html-kit.com/favicon/ or http://www.favicon.cc/), d

mod_python error when debug=False

2009-02-27 Thread Michael Repucci
I've been trying to put my site up live, and keep coming across an error (on any page on the site) whenever I set debug=False in settings.py. With the development server, or with debug=True on the production server, I don't have this problem at all. I searched for a similar problem on djangoprojec

Re: Is safe unsafe?

2009-02-24 Thread Michael Repucci
orks under Windows ;-) > > -- Horst > > On Tue, Feb 24, 2009 at 6:01 PM, Michael Repucci wrote: > > Hi again. So after much reading and consideration, I decided I'd like > > to try html5lib. Unfortunately, it seems that the current version > > html5lib-0.11.1.zip (http:

Re: Is safe unsafe?

2009-02-24 Thread Michael Repucci
(http://pypi.python.org/pypi/setuptools). But I'm running Python 2.6. I haven't had much experience with adding packages to Python, so if there's a workaround for this (aside from using Python 2.5), could somebody please share. Thanks! On Feb 24, 10:09 am, Michael Repucci wrote: > Hi Ever

Re: Is safe unsafe?

2009-02-24 Thread Michael Repucci
Hi Everybody, I just wanted to give a HUGE THANKS to everyone participating in this discussion. It's exactly the kind of information I was hoping I could get from all of you; more than enough to keep a newbie like me occupied on the topic for quite some time. So thanks again for sharing your knowl

Re: Is safe unsafe?

2009-02-23 Thread Michael Repucci
2:04 PM, Michael Repucci wrote: > > > Obviously the latter would > > be safer, but there's worth in having the added flexibility, provided > > I haven't left a huge hole open. > > What hole is there to leave open? So they upload a .exe, you aren't   > exec

Re: Is safe unsafe?

2009-02-23 Thread Michael Repucci
Obviously the latter would be safer, but there's worth in having the added flexibility, provided I haven't left a huge hole open. On Feb 23, 4:50 pm, Andy Mckay wrote: > On 23-Feb-09, at 1:45 PM, Michael Repucci wrote: > > > Of course, now I'm a bit scared (thanks to my inexpe

Re: Is safe unsafe?

2009-02-23 Thread Michael Repucci
ply remove text between tags, or are XSS attacks possible through other HTML tags as well (that's still a bit unclear to me)? Thanks for your help! On Feb 23, 3:17 pm, Colin Bean wrote: > On Mon, Feb 23, 2009 at 12:03 PM, Michael Repucci wrote: > > > I'm certainly worried abou

Re: Is safe unsafe?

2009-02-23 Thread Michael Repucci
think the > server and the clients should be safe for the general public, and I > don't want to make it that easy on you.  Allowing some script kiddie > to load JS into a field that will play back on someone else's machine > is reprehensible, even if those users aren'

Is safe unsafe?

2009-02-23 Thread Michael Repucci
Hi Django'ers, this will probably sound like a silly question, but normally I haven't had to think about server security (that's been someone else's job). However, on my current project I do need to consider this, and I just wanted to double-check that I understand the risks of using the "safe" ta

Re: file validation in admin form

2009-02-20 Thread Michael Repucci
ou the > link as I'm not at my laptop, but if you search the django docs for > "form validation" "clean" or "cleaned_data" you should be able to find > the right doc. You want to read about the clean method an is_valid(). > > On 20 Feb., 22:09, Mich

file validation in admin form

2009-02-20 Thread Michael Repucci
I'm totally new to Django and authorized/secure web apps, and really loving it for this. But I've got a few really novice questions. I've got a model with a FileField, to which users can upload an arbitrary file. In the model docs for the FileField it says, "Validate all uploaded files." And I'm n

Re: need help limiting choices on admin form for ForeignKey field

2009-02-12 Thread Michael Repucci
Oh, bummer. Is there a *not so good* way to do it in 1.0.2? It'd be nice to do it at all. Or is it perhaps not as scary as I think (as a newbie) to use the latest development version? On Feb 12, 3:35 pm, Alex Gaynor wrote: > On Thu, Feb 12, 2009 at 3:33 PM, Michael Repuc

Re: need help limiting choices on admin form for ForeignKey field

2009-02-12 Thread Michael Repucci
It seems that the formfield_for_dbfield method doesn't have a hook for the request. So unless I'm mistaken, I can't use it to filter the Contact instances by the currently logged in user (request.user). Any other thoughts? On Feb 12, 3:12 pm, Michael Repucci wrote: > Oh. It do

Re: need help limiting choices on admin form for ForeignKey field

2009-02-12 Thread Michael Repucci
Oh. It doesn't mention that in the documentation. I am using 1.0.2- final. I'll check out formfield_for_dbfield. Thanks for the pointer! On Feb 12, 3:09 pm, Alex Gaynor wrote: > On Thu, Feb 12, 2009 at 3:07 PM, Michael Repucci wrote: > > > > > > > I'm ne

need help limiting choices on admin form for ForeignKey field

2009-02-12 Thread Michael Repucci
I'm new to Django, and already loving it. But I'm stumbling a bit with how to accomplish the following task. Perhaps this isn't the best approach, but most of the site is working as planned, and it was super easy to get up and running. I have a Contact model and a Person model, the latter of whic

Re: how to associate django admin user with particular instances of certain model objects

2009-02-04 Thread Michael Repucci
That was EXACTLY what I was looking for!! Very clear and simple, with links to the documentation. That makes me so happy! Thank you a million times!! On Feb 4, 10:57 am, Karen Tracey wrote: > On Wed, Feb 4, 2009 at 10:48 AM, Michael Repucci wrote: > > > > > > > Hi Dja

how to associate django admin user with particular instances of certain model objects

2009-02-04 Thread Michael Repucci
Hi Django'ers! I'm brand new to Django, and I'm totally loving it. But I can't seem to find the answer to a task I've encountered with a site that I'm developing. I'm a moderately experienced Python programmer, only a mediocre web developer, and as I said a newbie with Django, so please pardon me