Overriding default manager at import-time

2009-02-23 Thread fero
I tried to override the default manager when I am importing my views. I noticed that I needed to do override both; * objects attribute * _default_manager attribute In my views module I do something like from app.models import MyModel from app.models.managers import MyManager MyModel.a

Mosso file storage backend

2009-02-23 Thread sleepyjames
Has anyone already written a storage backend for Mosso's cloud files, cos I can't find one. --~--~-~--~~~---~--~~ 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@goog

Changing the objects manager without affecting the admin interface ?

2009-02-23 Thread happy
Hello All, I would like to change the objects manager for a Worker class such that it only outputs workers for which the user auth.user is active in the system. The idea is to make invisible the workers that do not have an active account. The problem if I do that is that the inactive workers wil

how to use django ORM in standalone script ?

2009-02-23 Thread Konstantin S
Hello! I need to postprocess some data in my models and the most natural way of doing this would be to run periodically standalone script. But on the other hand I want to use framework ORM just because it would much more handy than raw sql. What should I import to plug in django in standalone scr

Hosting an Email server and receiving all mails pertaining to @mysite.com

2009-02-23 Thread madhav
I am starting a project in a couple of mins. But I have question about emails regarding mywebsite. Assuming its mysite.com. Everyuser will be getting an email address say something like j...@mysite.com. Any person using the same website or any other website or any one on the planet can send an ema

Re: Overriding default manager at import-time

2009-02-23 Thread Alex Gaynor
On Mon, Feb 23, 2009 at 5:38 AM, fero wrote: > > I tried to override the default manager when I am importing my views. > > I noticed that I needed to do override both; > >* objects attribute >* _default_manager attribute > > In my views module I do something like > > from app.models impor

Re: Changing the objects manager without affecting the admin interface ?

2009-02-23 Thread Alex Gaynor
On Mon, Feb 23, 2009 at 8:03 AM, happy wrote: > > Hello All, > > I would like to change the objects manager for a Worker class such > that it only outputs workers for which the user auth.user is active in > the system. The idea is to make invisible the workers that do not > have an active accoun

Re: how to use django ORM in standalone script ?

2009-02-23 Thread Alex Gaynor
On Mon, Feb 23, 2009 at 8:04 AM, Konstantin S wrote: > > Hello! > > I need to postprocess some data in my models and the most natural way > of doing this would be to run periodically standalone script. But on > the other hand I want to use framework ORM just because it would much > more handy tha

how to use strings in queries?? or do lookups with dynamic number of Q objects?

2009-02-23 Thread PeteDK
Hi there. I am trying to make a search function. lookupInt1 = 1 print "inden loekke" for i in fromCityList: print "test"+ i.by

Re: how to use django ORM in standalone script ?

2009-02-23 Thread David Reynolds
2009/2/23 Konstantin S : > > Hello! > > I need to postprocess some data in my models and the most natural way > of doing this would be to run periodically standalone script. But on > the other hand I want to use framework ORM just because it would much > more handy than raw sql. What should I impo

Re: Hosting an Email server and receiving all mails pertaining to @mysite.com

2009-02-23 Thread David Reynolds
2009/2/23 madhav : > > I am starting a project in a couple of mins. But I have question about > emails regarding mywebsite. Assuming its mysite.com. Everyuser will be > getting an email address say something like j...@mysite.com. Any > person using the same website or any other website or any one

Re: how to use strings in queries?? or do lookups with dynamic number of Q objects?

2009-02-23 Thread Oxford
Hi Pete Have you tried chaining the filters? q = Entry.objects.filter(headline__startswith="What") for x in range(x): q = q.filter(pub_date__lte=x) http://docs.djangoproject.com/en/dev/topics/db/queries/#id3 I've used this chaining method with filters. I would expect Q objects would be fi

Table or view does not exist - Oracle

2009-02-23 Thread Brandon Taylor
Hi everyone, Still fighting with Oracle :( Quick recap...my setup is: OS X 10.5.6 (Intel), cx_Oracle-5.0.1 (Intel), instantclient_10_2, Django Trunk, Python 2.6.1 If I run Django in shell, I am able to connect to Oracle, retrieve objects via the ORM, etc. However, when I executing a view acti

Send_mail usage on development server.

2009-02-23 Thread NoviceSortOf
Note: Ubuntu Hardy development server. I've having problems getting Send_mail to work on my development server. It works fine on the production server but when I attempt to send on the development server I get the following error. * /usr/lib/python2.5/smtplib.py in connect, line 296 -

Delete "hook" for admin

2009-02-23 Thread Cody Robertson
*WARNING* I am a novice to Django - play nice :) After digging I can't seem to find any sort of "hook" (similar to save_model) for deletions in the admin section (django.contrib). Am I missing something or is there a "cleaner" or "proper" way to do this? --~--~-~--~~~---

Re: Overriding default manager at import-time

2009-02-23 Thread fero
I have already multiple managers... This is needed in order to override the default behaviour in an application instance, but not in another one... On 23 Feb, 15:06, Alex Gaynor wrote: > On Mon, Feb 23, 2009 at 5:38 AM, fero wrote: > > > I tried to override the default manager when I am imp

Re: Delete "hook" for admin

2009-02-23 Thread David Reynolds
2009/2/23 Cody Robertson : > > *WARNING* I am a novice to Django - play nice :) > > After digging I can't seem to find any sort of "hook" (similar to > save_model) for deletions in the admin section (django.contrib). > > Am I missing something or is there a "cleaner" or "proper" way to do > this?

Re: passing arguments in HttpResponseRedirect(reverse())

2009-02-23 Thread Guri
I apologize for not being clear first time. Its so idiot of me. Here m trying to provide a search page having a text box input and a radio button. User types one or more tags to search and a radio input button decides to either search local user account data or all database for links. Also there

Re: Oracle connection issue

2009-02-23 Thread Brett Parker
On 20 Feb 14:43, Brandon Taylor wrote: > > No proxy server configured in FireFox 3. I'm stumped as well. Guess I > need to have the Oracle people in my office get in touch with their > support people. There is one other Django person here at the > University that might be able to help. > > I'll

Re: Delete "hook" for admin

2009-02-23 Thread Cody Robertson
On Feb 23, 11:24 am, David Reynolds wrote: > 2009/2/23 Cody Robertson : > > > > > *WARNING* I am a novice to Django - play nice :) > > > After digging I can't seem to find any sort of "hook" (similar to > > save_model) for deletions in the admin section (django.contrib). > > > Am I missing someth

Unusual Schema question

2009-02-23 Thread Jay Deiman
Let me quickly say that I'm a PHP programmer that quite recently made the switch to Django (and I'm VERY happy with it so far). I've been working with Python for a couple years now as well. The question I have is basically a "what would be the best way to do this question". I'm setting up a

Re: OperationalError 1366 Incorrect string value ... for column 'message'

2009-02-23 Thread SeanB
Bingo, that was precisely the problem: altering the message field to use utf8_general_ci solved it. Thanks, i was really pulling my hair out over this one! Sean On Feb 20, 5:18 pm, Karen Tracey wrote: > On Fri, Feb 20, 2009 at 8:00 PM, SeanB wrote: > > > I have an application that include Unic

Re: ImageField causing error when rendering with "The Image" attribute has no file associated with it.

2009-02-23 Thread mermer
Anybody with any advice on this. Ever since wev'e upgraded to version 1.00 we are having issues with the ImageField ValueError: The 'image' attribute has no file associated with it. On 19 Feb, 12:30, mermer wrote: > Since I've upgraded to Django ver 1.00,  I'm suddenly getting the > following

select_related() and reverse foreign keys -OR- how to I get a blog post and its comments?

2009-02-23 Thread sphogan
I'm surprised that this hadn't come up for me before, but nonetheless, here I am. My problem is that I want to get related items (in a similar situation to getting blog articles with their comments) without looping a second lookup (since it would be a couple thousand items and building a page off

More efficient: fewer queries or fewer model fields?

2009-02-23 Thread Michael Strickland
More of a general best practices question for Model design with respect to query efficiency: I'm designing the schema for a newspaper site that will have 2-3 main types of content: Articles (with a rigid, standardized presentation), Articles (with heavy HTML customization), and general Content (f

Re: Unusual Schema question

2009-02-23 Thread gordyt
Jay I'm not sure if this would meet your requirements or not, but I think you should take a look at this page concerning generic relations: http://docs.djangoproject.com/en/dev/ref/contrib/contenttypes/#id1 Regards, --gordon --~--~-~--~~~---~--~~ You received thi

Re: Unusual Schema question

2009-02-23 Thread Tim Chase
> The idea here is to have a central join table to allow many to > many relationships between any and all of the "object" tables > rather than have a zillion join tables and a rigid structure. > This allows me to add object tables easily down the road since > that will probably be necessary. It's

Has anyone used the django database as a backend for openldap?

2009-02-23 Thread Eric Chamberlain
Hi, We have various servers and tools that can use LDAP for users, groups, and authentication. The users and groups information we would like to use is in django. Has anyone used the django database as a slapd backend? Enabling OpenLDAP to serve up the django user information LDAP style.

Authenticating django users from Apache using cookies

2009-02-23 Thread Karantir
Hi guys. I have a question regarding the article about authenticating against django's user database from Apache (http://docs.djangoproject.com/en/ dev/howto/apache-auth/#howto-apache-auth). In my project i'm using traditional cookie based authentication model. And i need to restrict user access

Simplest way to do this?

2009-02-23 Thread Kevin Audleman
Hello, I am using the excellent django-profiles module provided by Ubernostrum which gives my site the following views: - list members - view member - edit member The module handles all of the views and urls so basically all I had to do was write templates and put a slug into my urls.py. The r

Re: Simplest way to do this?

2009-02-23 Thread Daniel Roseman
On Feb 23, 7:19 pm, Kevin Audleman wrote: > Hello, > > I am using the excellent django-profiles module provided by > Ubernostrum which gives my site the following views: > > - list members > - view member > - edit member > > The module handles all of the views and urls so basically all I had to >

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: Send_mail usage on development server.

2009-02-23 Thread Karen Tracey
On Mon, Feb 23, 2009 at 10:18 AM, NoviceSortOf wrote: > > Note: Ubuntu Hardy development server. > > I've having problems getting Send_mail to work on my development > server. > It works fine on the production server but when I attempt to send on > the development server I get the following error.

Re: Is safe unsafe?

2009-02-23 Thread Mark Jones
Kind of sucks that you are worried about your server, but not worried about the people that might use your site. I'd answer your question regarding JS except for the fact I 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. Allow

Re: Is safe unsafe?

2009-02-23 Thread Michael Repucci
I'm certainly worried about both, but I would like the users to be able to add JavaScript. Changes to the site will actually have to be monitored for offensive content (including both JavaScript and offensive language), so hopefully such content wouldn't be up for very long. But I was just worried

Re: Is safe unsafe?

2009-02-23 Thread Colin Bean
On Mon, Feb 23, 2009 at 12:03 PM, Michael Repucci wrote: > > I'm certainly worried about both, but I would like the users to be > able to add JavaScript. Changes to the site will actually have to be > monitored for offensive content (including both JavaScript and > offensive language), so hopeful

Fwd: python sql query in django

2009-02-23 Thread James Matthews
-- Forwarded message -- From: May Date: Mon, Feb 23, 2009 at 9:17 PM Subject: python sql query in django To: python-l...@python.org I have three tables: class Technology(models.Model): technology = models.CharField(max_length=100, null=True, blank=True ) def __unicode__(se

default value for foreign key

2009-02-23 Thread knight
Hi, I have models.py like this: class Media_biz(models.Model): --- default = models.BooleanField("Default", blank=True, null=True) --- def get_default_Media_biz(): if Media_biz.objects.filter(default=True).count() != 0: return Media_biz.objects.filter(default=True)[0]

Re: select_related() and reverse foreign keys -OR- how to I get a blog post and its comments?

2009-02-23 Thread Alex Gaynor
On Mon, Feb 23, 2009 at 12:40 PM, sphogan wrote: > > I'm surprised that this hadn't come up for me before, but nonetheless, > here I am. > > My problem is that I want to get related items (in a similar situation > to getting blog articles with their comments) without looping a second > lookup (si

Re: ImageField causing error when rendering with "The Image" attribute has no file associated with it.

2009-02-23 Thread Karen Tracey
On Thu, Feb 19, 2009 at 7:30 AM, mermer wrote: > > Since I've upgraded to Django ver 1.00, I'm suddenly getting the > following error with my ImageFields. > > The tag is {{ model.image.url}} and it throws an error if the image > field in the database is null (even if it is set to null in the mod

Re: select_related() and reverse foreign keys -OR- how to I get a blog post and its comments?

2009-02-23 Thread Torsten Bronger
Hallöchen! Alex Gaynor writes: > On Mon, Feb 23, 2009 at 12:40 PM, sphogan wrote: > >> [...] >> >> However, select_related() only works on the object the foreign >> key is declared on >> (http://docs.djangoproject.com/en/dev/ref/models/querysets/ #id4 >>

Re: Fwd: python sql query in django

2009-02-23 Thread Christian Joergensen
James Matthews wrote: > I have three tables: > > class Technology(models.Model): >technology = models.CharField(max_length=100, null=True, > blank=True ) >def __unicode__(self): >return self.technology >class Meta: >ordering = ["technology"] > > class Publication(mode

Re: select_related() and reverse foreign keys -OR- how to I get a blog post and its comments?

2009-02-23 Thread Alex Gaynor
On Mon, Feb 23, 2009 at 3:49 PM, Torsten Bronger < bron...@physik.rwth-aachen.de> wrote: > > Hallöchen! > > Alex Gaynor writes: > > > On Mon, Feb 23, 2009 at 12:40 PM, sphogan wrote: > > > >> [...] > >> > >> However, select_related() only works on the object the foreign > >> key is declared on >

Not understand help_text

2009-02-23 Thread Mark Jones
When a model field has help_text, that text will be show in the form. I'm a little bothered by this because effectively the model is doing something that really belongs in the view, but I understand the point is to make it easy to create forms based on a model and I can just live with it. What bo

Re: select_related() and reverse foreign keys -OR- how to I get a blog post and its comments?

2009-02-23 Thread Sean Patrick Hogan
It isn't *an* extra SQL query that I'm worried about. It's that it's going to be about 2,000 extra SQL queries in a loop. If it were just constructing a page with one item and then its related items, that's not a problem to do two queries, but when you're looping over 2,000 items and running an

Re: Not understand help_text

2009-02-23 Thread Alex Gaynor
On Mon, Feb 23, 2009 at 4:10 PM, Mark Jones wrote: > > When a model field has help_text, that text will be show in the form. > I'm a little bothered by this because effectively the model is doing > something that really belongs in the view, but I understand the point > is to make it easy to creat

Re: select_related() and reverse foreign keys -OR- how to I get a blog post and its comments?

2009-02-23 Thread Alex Gaynor
On Mon, Feb 23, 2009 at 4:10 PM, Sean Patrick Hogan wrote: > It isn't *an* extra SQL query that I'm worried about. It's that it's going > to be about 2,000 extra SQL queries in a loop. If it were just constructing > a page with one item and then its related items, that's not a problem to do > tw

Re: select_related() and reverse foreign keys -OR- how to I get a blog post and its comments?

2009-02-23 Thread Karen Tracey
On Mon, Feb 23, 2009 at 12:40 PM, sphogan wrote: > > I'm surprised that this hadn't come up for me before, but nonetheless, > here I am. > > My problem is that I want to get related items (in a similar situation > to getting blog articles with their comments) without looping a second > lookup (si

Static file serve with prior authentication?

2009-02-23 Thread Katja Loeffler
Hey there, I have been looking for a solution to make a file download with prior authentication ... Until now the only way I have to have a login page, after a successful login the users will be provided the link to the file and they can then download it. But this is not really "protected" sin

Re: Is safe unsafe?

2009-02-23 Thread Michael Repucci
Thank you! That was the kind of thing I was worried about, but wasn't sure existed. Of course, now I'm a bit scared (thanks to my inexperience), and tempted to not use the safe filter at all, letting everything get escaped. But there are thousands of sites (e.g., message boards, blog sites, etc.)

Re: Simplest way to do this?

2009-02-23 Thread Kevin Audleman
Great idea, I'll do that. Thanks! Kevin On Feb 23, 11:30 am, Daniel Roseman wrote: > On Feb 23, 7:19 pm, Kevin Audleman wrote: > > > > > Hello, > > > I am using the excellent django-profiles module provided by > > Ubernostrum which gives my site the following views: > > > - list members > > -

Re: Is safe unsafe?

2009-02-23 Thread Andy Mckay
On 23-Feb-09, at 1:45 PM, Michael Repucci wrote: > Of course, now I'm a bit scared (thanks to my inexperience), and > tempted to not use the safe filter at all, letting everything get > escaped. But there are thousands of sites (e.g., message boards, blog > sites, etc.) where users can post messa

Re: Static file serve with prior authentication?

2009-02-23 Thread Andy Mckay
On 23-Feb-09, at 1:44 PM, Katja Loeffler wrote: > I have been looking for a solution to make a file download with prior > authentication ... > > But this is not really "protected" since they can make the link public > once they have it and everyone can download without prior login. > > I have us

Re: Is safe unsafe?

2009-02-23 Thread Michael Repucci
Thanks! That's a great place for me to start. While we're on the general topic of security, I've got another question. In my application, users are also allowed to upload a file, which will be served (to allow other users or visitors to download it). I've used a clean_() method on the form to sca

A question about templates and search.

2009-02-23 Thread djandrow
Hello, Each of the html pages on my site extends base.html but i'm trying to get a search box going which will appear on each page. So this will go on the base.html template. Since base.html is never called except through other templates. In what view should the code for this go in, i can't imang

Re: A question about templates and search.

2009-02-23 Thread Daniel Roseman
On Feb 23, 10:00 pm, djandrow wrote: > Hello, > > Each of the html pages on my site extends base.html but i'm trying to > get a search box going which will appear on each page. So this will go > on the base.html template. Since base.html is never called except > through other templates. In what v

Objects Tied to Sites and Users

2009-02-23 Thread richleland
Hi all - hoping I can get some insight. Suppose we have a the following models: - Regions (e.g. North, South, East, West) - Users (site editors) - Objects (e.g. Cars) Each Object can be tied to only one Region (ForeignKey). Each User can be tied to multiple Regions (M2M). When a User signs in to

Re: Is safe unsafe?

2009-02-23 Thread Andy Mckay
On 23-Feb-09, at 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 executing it are you? -- Andy McKay

Re: Static file serve with prior authentication?

2009-02-23 Thread Graham Dumpleton
On Feb 24, 8:53 am, Andy Mckay wrote: > On 23-Feb-09, at 1:44 PM, Katja Loeffler wrote: > > > I have been looking for a solution to make a file download with prior > > authentication ... > > > But this is not really "protected" since they can make the link public > > once they have it and every

Using / in prepopulate_from fields

2009-02-23 Thread lol lollrtsen
Hello I am trying to use a charfield with the prepopulate_from option to generate an url. My problem is just that prepopulate_from does'nt allow the use of /. I'm using it like this in the admin.py: prepopulated_fields = {"url" : ('_url',)} Does anyone know if it is possible to make p

Re: Is safe unsafe?

2009-02-23 Thread Michael Repucci
No, but it will be served, so a PHP file would constitute a hole (without my regexp filter), and I'm just not confident that I thought of all the extensions that the server will execute automatically when such a file is served. On Feb 23, 5:18 pm, Andy Mckay wrote: > On 23-Feb-09, at 2:04 PM, Mi

Re: Unusual Schema question

2009-02-23 Thread Jay Deiman
Tim Chase wrote: >> The idea here is to have a central join table to allow many to >> many relationships between any and all of the "object" tables >> rather than have a zillion join tables and a rigid structure. >> This allows me to add object tables easily down the road since >> that will probab

Re: Static file serve with prior authentication?

2009-02-23 Thread Katja Loeffler
> You don't really want use django.views.static.serve in the real world OK ;). > http://docs.djangoproject.com/en/dev/howto/apache-auth/ Thanks! I'll have a look. Katja --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google

Re: Unusual Schema question

2009-02-23 Thread Jay Deiman
gordyt wrote: > Jay I'm not sure if this would meet your requirements or not, but I > think you should take a look at this page concerning generic > relations: > > http://docs.djangoproject.com/en/dev/ref/contrib/contenttypes/#id1 Between this and the other link that Tim Chase posted, I think it

Re: How to populate a custom ModelForm?

2009-02-23 Thread Malcolm Tredinnick
On Sun, 2009-02-22 at 23:18 -0800, rajeesh wrote: > Sorry for not including the code before. I've dpasted it now: > http://dpaste.com/123850/ . > I get "Item not found" when I go to that entry. > Problem can be summarized as this: I've a model M with certain fields > and some foreign keys. I d

Re: Is safe unsafe?

2009-02-23 Thread Andy Mckay
On 23-Feb-09, at 2:27 PM, Michael Repucci wrote: > No, but it will be served, so a PHP file would constitute a hole > (without my regexp filter), and I'm just not confident that I thought > of all the extensions that the server will execute automatically when > such a file is served. Then you sho

Re: how to use django ORM in standalone script ?

2009-02-23 Thread Malcolm Tredinnick
On Mon, 2009-02-23 at 14:35 +, David Reynolds wrote: > 2009/2/23 Konstantin S : > > > > Hello! > > > > I need to postprocess some data in my models and the most natural way > > of doing this would be to run periodically standalone script. But on > > the other hand I want to use framework ORM j

Re: Overriding default manager at import-time

2009-02-23 Thread Malcolm Tredinnick
On Mon, 2009-02-23 at 02:38 -0800, fero wrote: > I tried to override the default manager when I am importing my views. > > I noticed that I needed to do override both; > > * objects attribute > * _default_manager attribute > > In my views module I do something like > > from app.models

Passing argument to Model.save via ModelForm

2009-02-23 Thread bretro...@gmail.com
Hello, I'd like to send an email when a Model is saved via it's ModelForm. I'm aware that I can override the save function of the model, then call it's super but I was wondering how to pass request.user.username to the Model's save function. Or if someone has a better suggestion I'd be willing t

Re: Oracle connection issue

2009-02-23 Thread Brandon Taylor
Hi Brett, I have that environment variable set as well, but no dice. The weird thing is I can connect to Oracle and retrieve objects when running Django in shell, but not through the built in server when executing a view action. Thanks, Brandon On Feb 23, 11:00 am, Brett Parker wrote: > On 20

Re: A question about templates and search.

2009-02-23 Thread djandrow
Yea, the code that processes the search and returns the results. Does it not need to go in views.py? Could i just import it? > By 'code' I presume you mean the code that processes the search > queries and returns results?  It can go wherever you like, and the > search box just posts to the view t

Re: Passing argument to Model.save via ModelForm

2009-02-23 Thread Alex Gaynor
On Mon, Feb 23, 2009 at 5:40 PM, bretro...@gmail.com wrote: > > Hello, > > I'd like to send an email when a Model is saved via it's ModelForm. > I'm aware that I can override the save function of the model, then > call it's super but I was wondering how to pass request.user.username > to the Model

Re: More efficient: fewer queries or fewer model fields?

2009-02-23 Thread Malcolm Tredinnick
On Mon, 2009-02-23 at 10:38 -0800, Michael Strickland wrote: > More of a general best practices question for Model design with > respect to query efficiency: > > I'm designing the schema for a newspaper site that will have 2-3 main > types of content: Articles (with a rigid, standardized presenta

Re: default value for foreign key

2009-02-23 Thread Malcolm Tredinnick
On Mon, 2009-02-23 at 12:23 -0800, knight wrote: > Hi, > > I have models.py like this: > > class Media_biz(models.Model): > --- > default = models.BooleanField("Default", blank=True, null=True) > --- > > def get_default_Media_biz(): > if Media_biz.objects.filter(default=True).co

Re: Is safe unsafe?

2009-02-23 Thread Jacob Kaplan-Moss
On Mon, Feb 23, 2009 at 3:50 PM, Andy Mckay wrote: > You want to use a script to only allow certain HTML tags and enforce a > whitelist. Don't be naive and just use string or regular expression to > strip only a few, there's lots of hacks that can be done. I use the > SGMLParser in Plone, here's

Re: Passing argument to Model.save via ModelForm

2009-02-23 Thread bretro...@gmail.com
Perfect. Thanks! On Feb 23, 5:51 pm, Alex Gaynor wrote: > On Mon, Feb 23, 2009 at 5:40 PM, bretro...@gmail.com > wrote: > > > > > Hello, > > > I'd like to send an email when a Model is saved via it's ModelForm. > > I'm aware that I can override the save function of the model, then > > call it's

Re: Is safe unsafe?

2009-02-23 Thread Jacob Kaplan-Moss
On Mon, Feb 23, 2009 at 4:04 PM, Michael Repucci wrote: > While we're on the general topic of security, I've got another > question. In my application, users are also allowed to upload a file, > which will be served (to allow other users or visitors to download > it). I've used a clean_() method

Re: trying to get whether image is wider or deeper in templatetag

2009-02-23 Thread David MacDougall
Thanks again for all your help. I believe I have something that is finally working: class WideOrDeepNode(template.Node): def __init__(self, photoobj, varname): self.photoobj = photoobj self.varname = varname def render(self, context): self.photoobj = resolve_variab

RE: Beginner URL question.

2009-02-23 Thread Joe Goldthwaite
>You could try using a tag to explicitly state what the >base for relative URLs should be. Thanks Ned. That sounds like it will work. I'll try it. >I would sugest that you look at named urls and the {% url %} template >tag. That way you can generate urls with the use of args for year, >month

Re: select_related() and reverse foreign keys -OR- how to I get a blog post and its comments?

2009-02-23 Thread Malcolm Tredinnick
On Mon, 2009-02-23 at 21:49 +0100, Torsten Bronger wrote: > Hallöchen! > > Alex Gaynor writes: > > > On Mon, Feb 23, 2009 at 12:40 PM, sphogan wrote: [...] > >> What I would like to be able to do is: > >> > >> Article.objects.select_related('comment_set').all() > >> > >> This seems like a some

Re: comparisons with java framework

2009-02-23 Thread Jan Claeys
Op dinsdag 10-02-2009 om 20:09 uur [tijdzone +0900], schreef Russell Keith-Magee: > Time is an extremely limited resource on any volunteer project, And if you chase away potential volunteers that maybe want to implement a certain feature, time will become an even more limited resource... -- Ja

Re: Is safe unsafe?

2009-02-23 Thread Greg Ewing
Michael Repucci wrote: > But there are thousands of sites (e.g., message boards, blog > sites, etc.) where users can post messages that contain HTML - as I'd > like to do with my application - so I suspect that there must be > relatively simple solution. That depends on what you mean by "simple"

UnicodeEncodeError pb

2009-02-23 Thread arbi
Hi all, I got kind of classical error : "UnicodeEncodeError, 'ascii' codec can't encode character u'\xe9' in position 11: ordinal not in range (128)" In fact, it raises when going from view to template, and i think when registering some address in my database with an "é" ("e" with accent). I hav

Re: UnicodeEncodeError pb

2009-02-23 Thread Alex Gaynor
On Mon, Feb 23, 2009 at 6:58 PM, arbi wrote: > > Hi all, > > I got kind of classical error : "UnicodeEncodeError, 'ascii' codec > can't encode character u'\xe9' in position 11: ordinal not in range > (128)" > > In fact, it raises when going from view to template, and i think when > registering so

Re: Table or view does not exist - Oracle

2009-02-23 Thread Karen Tracey
On Mon, Feb 23, 2009 at 10:15 AM, Brandon Taylor wrote: > > Hi everyone, > > Still fighting with Oracle :( > > Quick recap...my setup is: > > OS X 10.5.6 (Intel), cx_Oracle-5.0.1 (Intel), instantclient_10_2, > Django Trunk, Python 2.6.1 > > > If I run Django in shell, I am able to connect to Oracl

Re: UnicodeEncodeError pb

2009-02-23 Thread Karen Tracey
On Mon, Feb 23, 2009 at 7:01 PM, Alex Gaynor wrote: > On Mon, Feb 23, 2009 at 6:58 PM, arbi wrote: > >> >> Hi all, >> >> I got kind of classical error : "UnicodeEncodeError, 'ascii' codec >> can't encode character u'\xe9' in position 11: ordinal not in range >> (128)" >> >> In fact, it raises wh

Re: UnicodeEncodeError pb

2009-02-23 Thread arbi
Thx for so quick answer :) I am on Django 1.0 do I need 1.0.2? my unicode is : def __unicode__(self): return self.address And my "address" is a String. Arbi On 24 fév, 01:01, Alex Gaynor wrote: > On Mon, Feb 23, 2009 at 6:58 PM, arbi wrote: > > > Hi all, > > > I got kind of classical erro

Re: UnicodeEncodeError pb

2009-02-23 Thread arbi
Here is the Traceback, need something else? Traceback: File "/Library/Python/2.5/site-packages/django/core/handlers/base.py" in get_response 86. response = callback(request, *callback_args, **callback_kwargs) File "/Users/brouard/antrive_docs/antrive/../antrive/routes/views.py"

Re: UnicodeEncodeError pb

2009-02-23 Thread Malcolm Tredinnick
On Mon, 2009-02-23 at 16:10 -0800, arbi wrote: > Here is the Traceback, need something else? > > > Traceback: > File "/Library/Python/2.5/site-packages/django/core/handlers/base.py" > in get_response > 86. response = callback(request, *callback_args, > **callback_kwargs) > File

get_absolute_url() and related models

2009-02-23 Thread bendavis78
I have products within categories. The url for a product is /store/ category-slug/product-slug. My question is about the best way to get the url for this product while looping through a product listing page. My view simply defines a context variable called products, assigned to the results of

Re: get_absolute_url() and related models

2009-02-23 Thread Malcolm Tredinnick
On Mon, 2009-02-23 at 16:21 -0800, bendavis78 wrote: > I have products within categories. The url for a product is /store/ > category-slug/product-slug. My question is about the best way to get > the url for this product while looping through a product listing > page. My view simply defines a

Re: get_absolute_url() and related models

2009-02-23 Thread Alex Gaynor
On Mon, Feb 23, 2009 at 7:21 PM, bendavis78 wrote: > > I have products within categories. The url for a product is /store/ > category-slug/product-slug. My question is about the best way to get > the url for this product while looping through a product listing > page. My view simply defines

Re: get_absolute_url() and related models

2009-02-23 Thread Alex Gaynor
On Mon, Feb 23, 2009 at 7:33 PM, Malcolm Tredinnick < malc...@pointy-stick.com> wrote: > > On Mon, 2009-02-23 at 16:21 -0800, bendavis78 wrote: > > I have products within categories. The url for a product is /store/ > > category-slug/product-slug. My question is about the best way to get > > t

Re: get_absolute_url() and related models

2009-02-23 Thread Malcolm Tredinnick
On Tue, 2009-02-24 at 11:33 +1100, Malcolm Tredinnick wrote: [...] > You can certainly simplify get_absolute_url() a bit: > > def get_absolute_url(self): >category_slug = self.category__slug Sorry, this is a typo. Should be self.category.slug -- normal attribute reference stu

Re: UnicodeEncodeError pb

2009-02-23 Thread Karen Tracey
On Mon, Feb 23, 2009 at 7:10 PM, arbi wrote: > > Here is the Traceback, need something else? > > Traceback: > File "/Library/Python/2.5/site-packages/django/core/handlers/base.py" > in get_response > 86. response = callback(request, *callback_args, > **callback_kwargs) > File "/U

Re: Validation problems with formset_factory

2009-02-23 Thread mediumgrade
Worked like a charm. It was the ModelChoice field. It was trigging the errors because of the initial value I was setting. On Feb 20, 7:48 pm, Malcolm Tredinnick wrote: > On Fri, 2009-02-20 at 19:32 -0800, mediumgrade wrote: > > So, I have a form like this: > > > > class AddUserForm(forms.Form):

Re: A question about templates and search.

2009-02-23 Thread djandrow
Also i have an archive list that is created from a db query that appears on every page: archive_list = Entry.objects.dates('entry_date', 'month', order='DESC') currently i have this in all of my views but that can't be very efficient, wheres the best place to put that? Andrew --~--~-~--

Re: A question about templates and search.

2009-02-23 Thread Malcolm Tredinnick
On Mon, 2009-02-23 at 17:12 -0800, djandrow wrote: > Also i have an archive list that is created from a db query that > appears on every page: > > archive_list = Entry.objects.dates('entry_date', 'month', > order='DESC') > > currently i have this in all of my views but that can't be very > effic

Re: Is safe unsafe?

2009-02-23 Thread Brian Neal
On Feb 23, 4:59 pm, Jacob Kaplan-Moss wrote: > On Mon, Feb 23, 2009 at 3:50 PM, Andy Mckay wrote: > > You want to use a script to only allow certain HTML tags and enforce a > > whitelist. Don't be naive and just use string or regular expression to > > strip only a few, there's lots of hacks that

Django 1.1 alpha 1 released

2009-02-23 Thread James Bennett
As we run up to Django 1.1 (due in April), we've started the process of alpha and beta preview packages with Django 1.1 alpha 1, released tonight. As always, alpha and beta packages are *not* for production use, but if you'd like to try out the new features or go bug-hunting in a safe environment,

  1   2   >