Re: Lookup by week

2006-01-30 Thread Max Battcher
Adrian Holovaty wrote: On 1/30/06, Jan Rademaker <[EMAIL PROTECTED]> wrote: Would it make sense to implement such a thing? An alternative would be to figure out at what date a week starts and ends and just use pub_date__range, but that's not really the point. I'm just curious how easy/hard it w

Re: Extending User

2006-01-30 Thread Roberto Aguilar
I've done this with the latter approach. I made a person model that had more person-specific information and made the user field a foreign key and added the edit_inline option to have the information right there in the user interface: user = meta.ForeignKey(auth.User, edit_inline=meta.STACKED, n

Re: I need some directions to auth system and stuff

2006-01-30 Thread Greg
Amit Upadhyay wrote: ... > {% if form.has_errors %} > Email or password incorrect > {% endif %} ... BTW I tried that, but ran into a small problem... hard-coding the error message in the template like that masks the fact that "please enter a correct username and password" isn't the only error th

Re: Extending User

2006-01-30 Thread char
That did it. Thanks.

Re: Extending User

2006-01-30 Thread Max Battcher
char wrote: I've seen a couple of approaches on this mailing list for adding application specific fields to the User class. The first involves extending auth.User but this seems a little complex, and was specifically labeled an "advanced" method. It doesn't seem like you should have to break out

Extending User

2006-01-30 Thread char
I've seen a couple of approaches on this mailing list for adding application specific fields to the User class. The first involves extending auth.User but this seems a little complex, and was specifically labeled an "advanced" method. It doesn't seem like you should have to break out deep black ma

Re: error restoring project

2006-01-30 Thread Luke Skibinski Holt
Ah excellent - I think it's natural to presume after fixing a bunch of errors and updating paths after restoring from backup to a new dir that the fault is more than likely on your end than with product. For anyone who follows, 'ordering' should be a list and look like: class META: ordering=

Re: possible to validate a subset of a model's fields?

2006-01-30 Thread Julio Nobrega
You could pickle (as in, serialize) the data and save on the database. Then just unpickle when you need to view it. On 1/30/06, Oliver Rutherfurd <[EMAIL PROTECTED]> wrote: > Thanks for the suggestion, but saving to the db after every page is a > requirement of the app. If someone fills out a

Re: possible to validate a subset of a model's fields?

2006-01-30 Thread Oliver Rutherfurd
Hi Amit, On 1/30/06, Amit Upadhyay <[EMAIL PROTECTED]> wrote: > On 1/31/06, Oliver Rutherfurd <[EMAIL PROTECTED]> wrote: > > The use case for this is a long registration process, where different > > data points from individual models are split across multiple pages. > > The application needs to s

Re: Error when relating a model to another model more than once

2006-01-30 Thread Russell Keith-Magee
On 1/31/06, Rudolph <[EMAIL PROTECTED]> wrote: Hi,I'm using the development version of Django (trunk) and I've got twosimple classes. The Language class should contain the two letterlanguage abbreviations and the full name of the language in English. The LanguageTranslation class should contain tra

Re: possible to validate a subset of a model's fields?

2006-01-30 Thread Amit Upadhyay
On 1/31/06, Oliver Rutherfurd <[EMAIL PROTECTED]> wrote: The use case for this is a long registration process, where differentdata points from individual models are split across multiple pages.The application needs to save data collected after every step, so theuser doesn't have to start from scrat

Re: Template inheritance problem

2006-01-30 Thread PythonistL
Adrian, Thank you for your reply. I still have problems with template inheritance Can you please help me with the following? I have the Index1.html ##Index1.html# {% extends "board/test" %} {% block title %}Tittle from Index.html {% endblock %} This is a text from Ind

Oracle support?

2006-01-30 Thread Robert Hicks
On the Django site it lists the currently implemented databases and say "more to come soon". Is Oracle on that list? And relatively speaking, how "soon" is soon? Robert

Re: What is save to use in __repr__

2006-01-30 Thread Jan Rademaker
A bit of code would have clarified my problem. This is what I tried the first time: return "Testing %s %s %.2f" % (self.someForeignKey.someThing(), self.somedate.strftime("%d-%m-%Y"), self.someFloat) There were 2 problems, basically. First, I tried to access an object instance directly and not t

possible to validate a subset of a model's fields?

2006-01-30 Thread Oliver Rutherfurd
Hi, Is there any way in Django to limit validation to a subset of a model's fields? What I'm looking for is an equivalent to Struts validator's 'page' attribute, which lets one specify that elements a, b, and c are on page 1 (and should be validated there), whereas elements d, e, and f are on pa

Re: FileField :: mx file size

2006-01-30 Thread Maniac
Waylan Limberg wrote: I envision a simple script that intercepts the upload submit, checks the actual file size against the specified limit (perhaps in a hidden field or hard coded in script or even via an ajax request (but why?)) and either returns an error message or submits the upload. No,

Re: What is save to use in __repr__

2006-01-30 Thread Adrian Holovaty
On 1/30/06, Jan Rademaker <[EMAIL PROTECTED]> wrote: > What is save to use __repr__ ? > > I've found out that I shoud use self.get_someForeignKey().someThing() > instead of self.someForeignKey.someThing(), but what about date fields > and such? > > Because, when I use self.someDateField in __repr_

Re: What is save to use in __repr__

2006-01-30 Thread Roberto Aguilar
I ran into the same thing in a model with a ForeignKey to an auth.User object. In my __repr__ function I had: self.get_user() which would crash Django. In this instance, I wanted the username specifically, so I resorted to using: self.get_user().username I didn't try, but I think this would

Re: FileField :: mx file size

2006-01-30 Thread Waylan Limberg
On 1/30/06, Amit Upadhyay <[EMAIL PROTECTED]> wrote: > On 1/30/06, Maniac <[EMAIL PROTECTED]> wrote: > > > > Amit Upadhyay wrote: > > > > > It would be good to have a general django wide setting specifying the > > > maximum length allowed for POST data, if underlying server allowed it. > > > > Dja

Re: editable in fields

2006-01-30 Thread Maniac
Tim TerlegÄrd wrote: To get a non-editable field you can do field = meta.CharField(editable = False). This is meant for hiding the field, right? Not to make it readonly in code? It means (as far as I know) that default manipulators will skip it and won't complain about their invalidity. So

Re: Error when relating a model to another model more than once

2006-01-30 Thread Rudolph
To be complete, this is the Error page I get: TypeError at /admin/reg/languages/2/ 'bool' object is not callable Request Method: GET Request URL:http://localhost:8000/admin/reg/languages/2/ Exception Type: TypeError Exception Value:'bool' object is not callable Exceptio

Re: What is save to use in __repr__

2006-01-30 Thread Maniac
Jan Rademaker wrote: What is save to use __repr__ ? I've found out that I shoud use self.get_someForeignKey().someThing() instead of self.someForeignKey.someThing(), but what about date fields and such? Because, when I use self.someDateField in __repr__ django crashes the moment _add_ a new o

Re: Lookup by week

2006-01-30 Thread Adrian Holovaty
On 1/30/06, Jan Rademaker <[EMAIL PROTECTED]> wrote: > Would it make sense to implement such a thing? An alternative would be > to figure out at what date a week starts and ends and just use > pub_date__range, but that's not really the point. I'm just curious how > easy/hard it would be to impleme

editable in fields

2006-01-30 Thread Tim TerlegÄrd
To get a non-editable field you can do field = meta.CharField(editable = False). This is meant for hiding the field, right? Not to make it readonly in code? To me hidden is more intuitive than editable. I thought that when so much was renamed anyway... :) Tim

What is save to use in __repr__

2006-01-30 Thread Jan Rademaker
What is save to use __repr__ ? I've found out that I shoud use self.get_someForeignKey().someThing() instead of self.someForeignKey.someThing(), but what about date fields and such? Because, when I use self.someDateField in __repr__ django crashes the moment _add_ a new object (using admin). Th

Re: FileField :: mx file size

2006-01-30 Thread Maniac
Amit Upadhyay wrote: No time for investigating it right now, but existence of those projects imply its doable, even if its a hack, atleast on some servers. Hm... Yes, they do it with some patched FCGI code.

Re: FileField :: mx file size

2006-01-30 Thread Adriano Bonat
I think that this is doable, but need to be implemented by an Apache Hook/Handler. I've done some searches now for something related with mod_python, but not found anything, just a link with this same problem but using Perl. http://www.experts-exchange.com/Web/Web_Languages/CGI/Q_20862752.html

Lookup by week

2006-01-30 Thread Jan Rademaker
Hello, As far is I know it's not possible to query date fields for a cerain week number, eg. # Select all polls from week 5, 2006 polls.get_list( pub_date__year=2006, pub_date__week=5 ) Would it make sense to implement such a thing? An alternative would be to figure out at what date a w

Re: FileField :: mx file size

2006-01-30 Thread Amit Upadhyay
On 1/30/06, Adrian Holovaty <[EMAIL PROTECTED]> wrote: As far as the validator I posted, it does the validation *before* thefile is saved to the filesystem, when it is still in memory.Hi Adrian,The original posters concern was The idea is to avoid an uneducated user uploading his 10 mb digital cam

Re: FileField :: mx file size

2006-01-30 Thread Amit Upadhyay
On 1/30/06, Maniac <[EMAIL PROTECTED]> wrote: Amit Upadhyay wrote:> It would be good to have a general django wide setting specifying the> maximum length allowed for POST data, if underlying server allowed it.Django just doesn't control these things. Read my answer in this very thread, it's http-se

Re: FileField :: mx file size

2006-01-30 Thread Maniac
Amit Upadhyay wrote: It would be good to have a general django wide setting specifying the maximum length allowed for POST data, if underlying server allowed it. Django just doesn't control these things. Read my answer in this very thread, it's http-server and browser that don't let it happe

assigning the related object

2006-01-30 Thread Jiri Barton
How do I switch (change) the related object in a many-to-one relationship? I'd like to have something like set_related_objects in many-to-many relationship... class RoomType(meta.Model): description = meta.CharField(maxlength=30) class Room(meta.Model): number = meta.CharField(maxlength=

Re: error restoring project

2006-01-30 Thread Max Battcher
Luke Skibinski Holt wrote: my hd failed the other day taking my db with it. I'm trying to restore my project now, but I'm getting this error in the admin app: ERROR: missing FROM-clause entry for table "auth_users" SELECT "blogs_blogs"."user_id","blogs_blogs"."title","blogs_blogs"."desc","blogs

Re: validators combined

2006-01-30 Thread Jiri Barton
Thank you very much. This is exactly what I've been looking for.

Re: Template inheritance problem

2006-01-30 Thread PythonistL
Adrian,thank you for your reply. Yes, they both are in the same (board) directory. So, what shall I try to find out the reason why it doesn't work? Thank you Regards, L.

Re: FileField :: mx file size

2006-01-30 Thread Eric Walstad
On Sunday 29 January 2006 20:29, arthur debert wrote: > is there a way to check for this BEFORE the file > is uploaded? On Monday 30 January 2006 08:15, Adrian Holovaty wrote: > On 1/30/06, tonemcd <[EMAIL PROTECTED]> wrote: > > So does this happen *before* the file is uploaded - I mean when the

Re: Template inheritance problem

2006-01-30 Thread Adrian Holovaty
On 1/30/06, PythonistL <[EMAIL PROTECTED]> wrote: > I have the Index1.html > ##Index1.html# > {% extends "board/test" %} > {% block title %}Tittle from Index.html {% endblock %} > This is a text from Index1.html > {%block mine%}Hello from Index1{%endblock%} > Text at

Re: validators combined

2006-01-30 Thread Adrian Holovaty
On 1/30/06, Jiri Barton <[EMAIL PROTECTED]> wrote: > I have two text input fields in a form. At least one of them is > required. My question is, how can I check for this? Hi Jiri, Check out RequiredIfOtherFieldNotGiven and RequiredIfOtherFieldsGiven in django/core/validators.py. Adrian -- Adri

Error when relating a model to another model more than once

2006-01-30 Thread Rudolph
Hi, I'm using the development version of Django (trunk) and I've got two simple classes. The Language class should contain the two letter language abbreviations and the full name of the language in English. The LanguageTranslation class should contain translated names of the languages: class Lan

Re: FileField :: mx file size

2006-01-30 Thread tonemcd
Cheers Adrian, that's very handy to know.. Tone

validators combined

2006-01-30 Thread Jiri Barton
I have two text input fields in a form. At least one of them is required. My question is, how can I check for this? class MyManipulator = (formfields.Manipulator): def __init__(self, request=None): self.fields = [ formfields.TextField( field_name='apples',

Re: mod_python installation problems

2006-01-30 Thread Adrian Holovaty
On 1/30/06, treelife <[EMAIL PROTECTED]> wrote: > Firstly, Debian 3.1 does not have a python2.4 version of the software > for Apache2.0 and when I install the 2.3 version Apache is giving me > some ".. Segmentation fault (11)". Try disabling the PHP Apache module. There are some known issues

Re: FileField :: mx file size

2006-01-30 Thread Adrian Holovaty
On 1/30/06, tonemcd <[EMAIL PROTECTED]> wrote: > So does this happen *before* the file is uploaded - I mean when the > submit button is pressed? It seems that Django will be getting > information from the browser about the length of the data to be > uploaded - and that's something I've always thou

Re: assign or rename a variable in templates

2006-01-30 Thread tonemcd
Bryan, If you can handle Zope PageTemplates, the plugin from Stefan might be useful: http://www.zope.org/Members/shh/DjangoPageTemplates That allows for variable creation, but of course you don't get the django templates... Cheers, Tone

Re: FileField :: mx file size

2006-01-30 Thread tonemcd
Amit, I think that's more a progress 'barber pole' widget than something which will detect the length of a file and drop the connection if it's over a certain size (although it's hard to tell...) Cheers, Tone

Re: FileField :: mx file size

2006-01-30 Thread Maniac
Adrian Holovaty wrote: def isSmallFile(self, field_data, all_data): if len(field_data["content"] > 1: # 10,000 bytes raise validators.ValidationError, "Please enter a smaller file." The trick here is to operate on field_data['content'] instead of field_data. File-uploa

Re: assign or rename a variable in templates

2006-01-30 Thread Bryan Murdock
On 1/18/06, Bryan Murdock <[EMAIL PROTECTED]> wrote: > On 1/18/06, Adrian Holovaty <[EMAIL PROTECTED]> wrote: > > > > On 1/17/06, Bryan Murdock <[EMAIL PROTECTED]> wrote: > > > Is it possible to somehow rename or assign one variable to another in > > > a template? All the generic views provide an

Re: FileField :: mx file size

2006-01-30 Thread Alex Bondarenko
On 1/30/06, tonemcd <[EMAIL PROTECTED]> wrote: > > So does this happen *before* the file is uploaded - I mean when the > submit button is pressed? It seems that Django will be getting > information from the browser about the length of the data to be > uploaded - and that's something I've always tho

Re: image field update impossible.

2006-01-30 Thread [EMAIL PROTECTED]
thank you mary ! MEDIA_ROOT = '/home/greg/Projects/woot/' with 'postimgs' as the path in imagefield allow editing without error.

error restoring project

2006-01-30 Thread Luke Skibinski Holt
my hd failed the other day taking my db with it. I'm trying to restore my project now, but I'm getting this error in the admin app: ERROR: missing FROM-clause entry for table "auth_users" SELECT "blogs_blogs"."user_id","blogs_blogs"."title","blogs_blogs"."desc","blogs_blogs"."entriespp","blogs_bl

mod_python installation problems

2006-01-30 Thread treelife
Many people seem to have some difficulties configuring apache mod_python, at least initially to work with Django. I have also had these initial configuration difficulties, but have successfully configured it on my local box, which runs Suse 9.3. However, I am having real difficulties just instal

Re: image field update impossible.

2006-01-30 Thread mary
u have to check your media_root that is in settings.py cause i think the problem is that he can't find the right path for your media files and the right path had to be media_root path+ the path of upload_to [EMAIL PROTECTED] wrote: > It doesn't solve the problem, i can't still override the image w