Re: sorting different in postgres than in sqlite

2009-06-30 Thread Jeff FW
Any reason not to make the total 0 instead of None? Null in database (or None in Python) has a special meaning, and it doesn't always make sense to sort a list of (mostly) integers with some null values. -Jeff On Jun 30, 2:01 am, J wrote: > Hello, > > I developed an app

Re: Trying to understand Django and Python from a C++ perspective

2009-06-30 Thread Jeff FW
You can actually do something like it fairly simply, by using the classmethod decorator, like so: class Thing: @classmethod def do_something(cls, some_arg): # do something with some_arg Then you could call it: Thing.do_something(3) Notice that you don't pass the "cls"

Re: Not displaying the data after space

2009-06-11 Thread Jeff FW
Take a look in the database itself (use the sqlite3 shell) and see if the full phrase is being stored. If it is, then there is an issue with how you are pulling the data out and displaying it in the form; if it isn't, then there is an issue with how you are saving the data in the first place.

Re: Can a form have select box and be filled in at the same time?

2009-05-29 Thread Jeff FW
Have a choice of "Other", and provide a separate field for the user to type in their own data. That's a pretty standard way to handle that. If you wanted to make it fancier, you could even have javascript to only show the "other" text box if they've chosen the "Other" option. -Jeff On May 29,

Re: IOError: request data read error (revisited)

2009-05-26 Thread Jeff FW
something wrong,) then I'm not too worried about it. I guess I won't know what they see until it happens to me, though :-) Thanks for your help, Jeff On May 25, 6:59 am, Graham Dumpleton <graham.dumple...@gmail.com> wrote: > On May 25, 4:53 am, Jeff FW <jeff...@gmail.com> wrote: > &

Re: IOError: request data read error (revisited)

2009-05-24 Thread Jeff FW
, 'wsgi.file_wrapper': , 'wsgi.input': , 'wsgi.multiprocess': True, 'wsgi.multithread': False, 'wsgi.run_once': False, 'wsgi.url_scheme': 'http', 'wsgi.version': (1, 0)}> Thanks a lot, Jeff On May 21, 10:47 pm, Graham Dumpleton <graham.dumple...@gmail.com> wrote: > On May 22, 12:31 pm,

Re: IOError: request data read error (revisited)

2009-05-21 Thread Jeff FW
I've had the same problem, and can't figure out how to resolve it. It seems to have nothing to do with the amount of data being transfered: it happens occasionally on the smallest of page requests/responses. It also doesn't seem to be related to browser, unless several different versions of IE

Re: login decorator losing POST data

2009-05-15 Thread Jeff FW
Sure--those are totally reasonable in most cases. However, the OP just said that all that's in the form is a single button, meaning most of those won't be an issue in this case. -Jeff On May 15, 10:03 am, Tim Chase wrote: > > If the form is just a single

Re: login decorator losing POST data

2009-05-15 Thread Jeff FW
If the form is just a single button, why not use GET and not have to deal with POST at all? -Jeff On May 14, 11:28 am, aa56280 wrote: > Tim, > > Thanks for the fantastic insight into the browser issues with 307 > redirects. I'll explore this a bit further and see which route

Re: Basic RSS in Django

2009-04-15 Thread Jeff FW
It looks like you're missing (or at least, didn't mention) the templates. In documentation: http://docs.djangoproject.com/en/dev/ref/contrib/syndication/#ref-contrib-syndication make sure to read the paragraph starting with "One thing's left to do" under "A simple example". -Jeff On Apr 15,

Re: How to handle the Browser Close ?

2009-04-01 Thread Jeff FW
http://docs.djangoproject.com/en/dev/topics/http/sessions/#session-expire-at-browser-close On Apr 1, 2:26 am, veeravendhan wrote: > Say a user is logged in to the system,  If he closes the browser how > will I handle the Logout for that user ? Any idea ??

Re: Modifu request.user

2009-03-31 Thread Jeff FW
Changing request.user.id doesn't make sense--that would be trying to change the id of the user object itself. I think what you're trying to do is change the user that is actually logged in... right? If that's true, then you need to set request.user *not* request.user.id-- but that seems like a

Re: Django bug that should be addressed: Idle timeouts do not clear session information

2009-03-18 Thread Jeff FW
My original suggestion would still work--run a cron job every minute (or so) that finds all of the sessions that have an expiration date since the last time the script was run--delete those, then log an entry in your audit table. Seems pretty simple to me, and I can't see any reason why it

Re: Django bug that should be addressed: Idle timeouts do not clear session information

2009-03-16 Thread Jeff FW
t; > I appreciate your responses and I stand corrected.  With that being > said, are either of you (or anyone reading this) aware of a method > that would allow me to track idle session timeouts?  I'd like to audit > when a user has been logged out due to a timeout. > > Huuu

Re: Django bug that should be addressed: Idle timeouts do not clear session information

2009-03-16 Thread Jeff FW
It's not a bug. When a cookie expires, the browser stops sending it with its requests--therefore, there is *no* way for Django to know that the cookie (and therefore, the session) has expired. There is no "timeout" happening on the server side, so the session can't get cleared out. Hence, why

Re: how to create bigint ?

2009-03-13 Thread Jeff FW
Especially since international phone numbers can start with 0--try storing that in an integer field, and you'll immediately run into problems. On Mar 13, 8:43 am, Ozan Onay wrote: > As Karen pointed out, you should consider a phone number to be a > string, not an integer.

Re: Why serializing to JSON doesn't work?

2009-03-06 Thread Jeff FW
se, the object has to be serializable.) > > > If that doesn't work, post the full (relevant) code. > > > -Jeff > > > On Mar 5, 7:01 am, Marek Wawrzyczek <mwawrzyc...@gmail.com> wrote: > > >> > Thomas Guettler wrote: > >

Re: opposite of icontains

2009-03-06 Thread Jeff FW
Clearly, you get to work on cooler projects than I :-) I had thought of the keywords/phrases case, but the other ones are far more interesting. Thanks for the explanation! -Jeff On Mar 5, 7:02 pm, Malcolm Tredinnick <malc...@pointy-stick.com> wrote: > On Thu, 2009-03-05 at 12:54 -0

Re: Why serializing to JSON doesn't work?

2009-03-05 Thread Jeff FW
Marek said for anything other than models (of course, the object has to be serializable.) If that doesn't work, post the full (relevant) code. -Jeff On Mar 5, 7:01 am, Marek Wawrzyczek <mwawrzyc...@gmail.com> wrote: > Thomas Guettler wrote: > > > Jeff FW schrieb: >

Re: opposite of icontains

2009-03-05 Thread Jeff FW
Well, then, that is quite a strange use case :-) Nevermind my simple methods. Malcom's suggestion of an extension for postgres seems like a good idea--writing functions in various languages (like Python!) is _really_ easy in postgres. Just out of curiosity (for either of you,) what is a search

Re: Why serializing to JSON doesn't work?

2009-03-04 Thread Jeff FW
The serializers are for serializing querysets/models. I'm surprised you're not getting an error message there--are you catching all exceptions? What you want is in django.utils.simplejson: from django.utils.simplejson import encoder encoder.JSONEncoder().encode(ret) -Jeff On Mar 4, 6:55 pm,

Re: opposite of icontains

2009-03-04 Thread Jeff FW
You'd have to split() the string (probably on spaces, though I don't know exactly what you're going for,) then build a query that checks for each piece OR'd with every other piece. That would probably be the best way--check out:

Re: Aggregating Ignores Slicing?

2009-03-03 Thread Jeff FW
as sum--in Python, and in SQL. On Mar 3, 11:36 am, Jeff FW <jeff...@gmail.com> wrote: > Responded too quickly :-) > > If you're already getting a list of the top 100 products (and > displaying them, I assume, in a loop,) then totalling up the prices in > Python really won't h

Re: Aggregating Ignores Slicing?

2009-03-03 Thread Jeff FW
products. -Jeff On Mar 3, 11:34 am, Jeff FW <jeff...@gmail.com> wrote: > The behavior is there because you can't limit an aggregate function in > (AFAIK) SQL in that way.  It just doesn't make sense--what would this > actually mean? > > select sum(price) from product limit 1

Re: Aggregating Ignores Slicing?

2009-03-03 Thread Jeff FW
The behavior is there because you can't limit an aggregate function in (AFAIK) SQL in that way. It just doesn't make sense--what would this actually mean? select sum(price) from product limit 100; Really, you'd be limiting the number of *rows* of sum returned, which, unless you're using GROUP,

Re: Problem outputting date in template as timestamp

2009-02-20 Thread Jeff FW
I just tried running the code that the "U" date-formatting parameter uses, and for me, it was off by about 11.5 days. According to the documentation, the "U" parameter is not implemented: http://docs.djangoproject.com/en/dev/ref/templates/builtins/#now According to this ticket, someone might

Re: user defined model

2009-02-10 Thread Jeff FW
As much as I hate to suggest it, this sounds like a good time to use XML. Store each report as XML (in a file, or in a database row), then use templates to render the data. -Jeff On Feb 9, 3:24 pm, Dids wrote: > > This is extremely unlikely to work, not to mention

Re: Bizarre sqlite3 / apache2 behaviour

2009-02-10 Thread Jeff FW
You need to make sure that the user apache is running as (usually "apache") has write access to the database file *and* the directory that the database file is in. The development server would work because *you* probably have write access to those paths. As for the sqlite3 version, run python,

Re: html italic tag hinders search code

2009-02-10 Thread Jeff FW
Yes, that's what I was suggesting. Sorry for not being more clear. As for storing the field twice, unless you're planning to have huge amounts of records, you wouldn't really noticed any difference at all. Also, you can have the admin interface set to *not* display the stripped version, so

Re: html italic tag hinders search code

2009-02-06 Thread Jeff FW
The issue has nothing to do with your templates--it has to do with your data, and how you're searching it. In the database, you have stored "Survival of Shigella". If you do a regular text search (field__contains, or similar) for "Survival of Shigella", you'll never get a match, because those

Re: Has anyone looked into writing an SSH backend for file uploads?

2009-01-30 Thread Jeff FW
xander.j.robb...@gmail.com> wrote: > It might be even easier to just set up an NFS mount of the other > machines. It would be a lot like Jeff's idea, but NFS is pretty tried > and true. (I don't know anything about SSHFS, it might be really good > too.) > > On Jan 30, 9:54 am,

Re: Has anyone looked into writing an SSH backend for file uploads?

2009-01-30 Thread Jeff FW
Instead of trying to get Django to do something like that, have you looked into using sshfs? That would make it essentially transparent-- all Django would know is that it's saving a file to a filesystem. http://en.wikipedia.org/wiki/SSHFS On Jan 29, 9:05 am, Andrew Ingram

Re: Frankenstein App (or: dynamic subtemplates)

2009-01-20 Thread Jeff FW
What you're looking for is explained in the documentation on writing your own template tags: http://docs.djangoproject.com/en/dev/howto/custom-template-tags/ Specifically, I'd look into inclusion tags: http://docs.djangoproject.com/en/dev/howto/custom-template-tags/#inclusion-tags -Jeff On Jan

Re: Putting pieces back together again

2009-01-12 Thread Jeff FW
Mark, You should really use Forms and FormSets--they'll make this problem essentially go away. http://docs.djangoproject.com/en/dev/topics/forms/#topics-forms-index http://docs.djangoproject.com/en/dev/topics/forms/formsets/ -Jeff On Jan 12, 12:46 am, Mark Jones wrote: >

Re: Django: creating formset is very slow

2009-01-06 Thread Jeff FW
Post the code for DataForm--I'll bet it's hitting the database a number of times. That would be the only reason I can think of that it would take that long. I just created a formset containing simple forms, and it instantiated almost instantly--even with 2000 forms. -Jeff On Jan 6, 3:21 pm,

Re: Django forms usage with mutliple rows

2009-01-06 Thread Jeff FW
Yup, that's exactly what formsets are for. You essentially take the form you've already written, and pass it to formset_factory() to create a list of identical forms. http://docs.djangoproject.com/en/dev/topics/forms/formsets/#topics-forms-formsets -Jeff On Jan 6, 1:02 am, "Kottiyath Nair"

Re: dynamically instantiate a model at run time

2008-12-24 Thread Jeff FW
I think you've got a small typo in the code there, that might be confusing to the OP--shouldn't the get_model() call have quotes around "tag"? Like so: model_class = get_model("test", "tag") -Jeff On Dec 23, 5:03 pm, bruno desthuilliers wrote: > On 23 déc,

Re: urls.py password reset view.

2008-12-20 Thread Jeff FW
That error is occuring because you don't have a URL defined for password_reset_done, which, presumably, is being referred to in your forgotpassword.html in a {% url %} tag. Check out this brief tutorial, it's rather handy: http://www.rkblog.rk.edu.pl/w/p/password-reset-django-10/ -Jeff On Dec

Re: del session variables

2008-12-20 Thread Jeff FW
Wow, you're right. I've been programming Python for years, and I somehow never noticed that. I'll be quiet not :-) On Dec 17, 6:33 pm, Malcolm Tredinnick <malc...@pointy-stick.com> wrote: > On Wed, 2008-12-17 at 15:09 -0800, Jeff FW wrote: > > You've got a s

Re: newie, django and apache, somethings are not working

2008-12-20 Thread Jeff FW
> the last line of the error is > > * > OperationalError: unable to open database file > ** > > NOtes: I have put the complete path for the DB /home/XXX/djangoProys/ > mysite2/DBmysite2, and I tried change permissions for database file Make sure that apache can read and write the

Re: Django Session Variables

2008-12-20 Thread Jeff FW
Looking at http://code.djangoproject.com/browser/django/trunk/django/contrib/auth/__init__.py#L46 it doesn't look like it clears the session. It *does* generate a new key, but that shouldn't affect anything. It should only take you about two minutes to test it though--just try it out. -Jeff

Re: Help with batch processing

2008-12-20 Thread Jeff FW
Check out: http://www.doughellmann.com/PyMOTW/contents.html He's got tutorials on quite a lot of the python stdlib--very handy resource. csv and zipfile are on there. -Jeff On Dec 19, 9:40 pm, Brandon Taylor wrote: > I've been looking at the methods from those libs.

Re: del session variables

2008-12-17 Thread Jeff FW
You've got a space in between "HttpResponseRedirect" and "('../ shop')" . On Dec 17, 2:44 pm, Bobby Roberts wrote: > > Have a look at theflush() method; I believe that might well be close to > > what you are after. > > > Regards, > > Malcolm > > I'm trying to call the view

Re: "Legal" way to have foreign key field in the custom form

2008-12-13 Thread Jeff FW
e, but it's strange since my template extends > the "admin/change_form.html". > > On Dec 12, 9:05 pm, Jeff FW <jeff...@gmail.com> wrote: > > > You're passing your queryset in, but you're never using it in your > > widget.  In my code, see how I have: > > &g

Re: "Legal" way to have foreign key field in the custom form

2008-12-12 Thread Jeff FW
f.widget = admin_widgets.RelatedFieldWidgetWrapper( >             forms.Select(), >             TournamentResult._meta.get_field('tournament').rel, >             admin.site, >         ) > > class UploadFormInitial(forms.Form): >     tournament = TournamentChoiceField(Tournament.objects.all()) > > B

Re: model string reprentations

2008-12-12 Thread Jeff FW
Sure do: it should be __str__() with two underscores on either side, not one. -Jeff On Dec 12, 7:33 am, ben852 wrote: > Hi, > I am new to django and programming. > I have a problem with the method _str_( ). > Following the tutorial, I edited my models.py file in

Re: can't get new model to show up in admin

2008-12-11 Thread Jeff FW
n, oh man, was that frustrating, > but hopefully now it won't bite me again.  Yes, I had made a "root" > user and a "norm" user, I was logged in as norm, and norm's not an > admin. > > All set now!  Thanks again! > > Norm > > On Dec 11, 10:13 am, Jeff FW <jeff...@

Re: can't get new model to show up in admin

2008-12-11 Thread Jeff FW
er, so I feel like > it's unlikely to be a Dreamhost issue. > Norm > > On Dec 11, 6:11 am, Jeff FW <jeff...@gmail.com> wrote: > > > Possibly a silly question--but did you run syncdb after adding > > staticimage2 to your INSTALLED_APPS? > > > -Jeff > > >

Re: can't get new model to show up in admin

2008-12-11 Thread Jeff FW
Possibly a silly question--but did you run syncdb after adding staticimage2 to your INSTALLED_APPS? -Jeff On Dec 10, 9:49 pm, Norm Aleks <[EMAIL PROTECTED]> wrote: > I'm using Django 1.0.2 (on Dreamhost, if that matters) and having > trouble getting a new model to show up.  I'm cringing a

Re: Index page using flatpages

2008-12-10 Thread Jeff FW
b.sites' modules and in some cases, they are worse than > good. > > Maybe I'm facing one of those cases, so I should get ride of those > modules and deploy an "extras" application with just views and > templates but no models (no database). > > If someone has some other hints

Re: Index page using flatpages

2008-12-09 Thread Jeff FW
Do you have CommonMiddleware enabled in your settings.py? http://docs.djangoproject.com/en/dev/ref/middleware/#module-django.middleware.common On Dec 9, 7:29 pm, Nuno Machado <[EMAIL PROTECTED]> wrote: > Hi, > > I'm using flatpages to display some static content in a site. The > "about" page is

Re: Using random.random() while running on server

2008-12-09 Thread Jeff FW
Also, as an aside to all of that--what you're generating is in no way guaranteed to be unique. If you really need a unique string, use a UUID or hash of the primary key. On Dec 9, 3:48 pm, bruno desthuilliers <[EMAIL PROTECTED]> wrote: > On 9 déc, 11:32, Chris <[EMAIL PROTECTED]> wrote: > > >

Re: Using random.random() while running on server

2008-12-09 Thread Jeff FW
issue that I > described. I tried passing it as default instead of using the save > method but does not work and since I am not passing random to default > directly, I cannot do this default=random.random. Any Ideas how I can > fix this? thanks. > > On Dec 9, 6:00 am, Jeff FW <[EMA

Re: Using random.random() while running on server

2008-12-09 Thread Jeff FW
Chris, It depends on where you're calling random.random(). If you're trying to do it in a model definition, then you're always going to have the value it chose when it first executed the model's class definition-- when the server starts up. In that case, you should be able to pass an argument

Re: "Legal" way to have foreign key field in the custom form

2008-12-09 Thread Jeff FW
To get the plus icon back, you need to wrap the field in a RelatedFieldWidgetWrapper. Here's an example from my code--obviously, you'll have to adapt it to fit your situation. class CategoryChoiceField(forms.ModelChoiceField): def __init__(self, *args, **kwargs):

Re: range-like template tag?

2008-12-07 Thread Jeff FW
You could write a very simple filter to do this. Something like (untested): def range(top): return xrange(0, top) then use {% for i in someInt|range %} I think it would still be better to pass it in the context--why can't you do that? -Jeff On Dec 7, 5:12 pm, Berco Beute <[EMAIL

Re: using settings in templates

2008-12-06 Thread Jeff FW
You can pass the settings object into your context when you render your template, or you can write a context processor that adds the settings object to the template's context. Take a look at the docs on context processors, especially the section about writing your own:

Re: How can I report a new user?

2008-12-06 Thread Jeff FW
Do you mean when a user is added via the admin interface, or when a user registers on the site through a view you have set up? If it's through a view you've made, then just add the call to send_mail() in the view. For the admin site, you'll want to look at signals:

Re: Django 1.0 no longer prints higher ASCII?

2008-11-30 Thread Jeff FW
What do you mean by "disappears"? How are you trying to output it? There's nothing special about the string that line generates, and I doubt anything would have changed between versions of Django that would stop that string from doing something it used to do. -Jeff On Nov 30, 10:56 am, Log0

Re: Usage opinion wanted

2008-11-27 Thread Jeff FW
too. > > Thanks a ton. > > Saurabh. > > On Wed, Nov 26, 2008 at 7:39 PM, Jeff FW <[EMAIL PROTECTED]> wrote: > > > This sounds, to me, like a great candidate for using Django.  Each of > > the separate modules you described could be a distinct application >

Re: Compare Lists for Unique Items

2008-11-27 Thread Jeff FW
s making 300+ save()'s in a try/except, 90% of which won't be committed > to the database? > > On Wed, Nov 26, 2008 at 9:00 AM, Jeff FW <[EMAIL PROTECTED]> wrote: > > > If you already have a unique key on the project's name field, then > > you're good to go--no duplicates will

Re: Usage opinion wanted

2008-11-26 Thread Jeff FW
; > I think not much networking is involved here, right, apart of course from > accessing the database server? > > I guess, now that I have read your emails and have noted down my > requirements, I would rather go with django, right? > > Thanks once again! > > Regard

Re: Compare Lists for Unique Items

2008-11-26 Thread Jeff FW
If you already have a unique key on the project's name field, then you're good to go--no duplicates will ever get inserted. No need to do any filtering ahead of time--just put each save() in a try/except block that catches the error you get and does nothing. -Jeff On Nov 25, 4:53 pm, "Alex

Re: multi field validation

2008-11-25 Thread Jeff FW
Alessandro, I'm not exactly sure what you're asking, but I think you want to know how to check multiple fields (possibly against each other) when submitting a form in the admin. Let me know if I'm off-base here. Take a look at:

Re: Usage opinion wanted

2008-11-25 Thread Jeff FW
Saurabh, I have spent the past year developing a GUI application (using wxPython) that communicates with a server (using Twisted), which connects to a PostgresQL database (using SQLAlchemy.) It has been a very rewarding experience learning and using all of these tools. However, the learning

Re: Custom Select widget choices - how to reuse choices?

2008-11-21 Thread Jeff FW
You could define the CHOICES as a member of your model class, like so: class Movie( Relic ): CHOICES=((u'1','one'), (u'2',u'two')) disk_type = models.CharField( 'Type', max_length=8, choices=CHOICES) Then, in your form: class MovieForm( BasicRelicForm ): disk_type =

Re: Using Admin From a Sub-Directory

2008-11-16 Thread Jeff FW
You need a trailing slash after /myapp/media/admin. The final URL will then come out to: http://localhost/media/admin/css/dashboard.css -Jeff On Nov 16, 11:37 am, Chris <[EMAIL PROTECTED]> wrote: > I'm trying to setup my app so it's accessible from a /myapp sub- > directory. I defined BASEURL

Re: creating django middleware

2008-11-12 Thread Jeff FW
I also wrote middleware for SQLAlchemy--I'd post it, but it depends on other libraries that I wrote that I can't really share. What I found is that, at least while using the dev server, the process_response method would get called when serving media files, even if the process_request hadn't.

Re: Keeping track of online users

2008-11-02 Thread Jeff FW
Can you be more specific? What are you trying to do? -Jeff On Nov 1, 3:52 pm, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote: > I have found some post of 2007 on this argument but maybe with django > 1.0 something is changed. > > how do you do that ? > > thanks everyone :)

Re: Is there a way to use the Cut Filter to only do the first instance?

2008-10-31 Thread Jeff FW
If you know the length of the string that you want to cut off the beginning, you could use slice: http://docs.djangoproject.com/en/dev/ref/templates/builtins/#slice Really, though, you might be going about this in a strange way. It might be better to use the url tag to get the correct URL that

Re: why not django's default server?

2008-10-25 Thread Jeff FW
And you don't need root access to install/run Apache either. It might be a pain to install w/o root, depending on your OS, but running it wouldn't be too hard, as long as you pick a port above 1024. One very good reason (I think) to avoid using Django's development server is the inability to

Re: variable tag / filter

2008-10-24 Thread Jeff FW
the future. -Jeff On Oct 24, 1:01 am, ramya <[EMAIL PROTECTED]> wrote: > I wanted to write one all purpose generic template.. > > Now I have split that and extended multiple specific templates.. :( > > Thanks, > ~ramyak/ > > On Oct 23, 6:34 pm, Jeff FW <[EMAIL PROTECT

Re: variable tag / filter

2008-10-23 Thread Jeff FW
To my knowledge, no, it's not possible to do that. Even if it was, however, I would strongly argue against it, as it would make your templates unreadable--how would you know what filter/tag would be called without mucking through the rest of your code? Maybe there's a better way to get the

Re: Accidentally creating a model with "def unicode(self):" will crash django with no stack trace

2008-10-23 Thread Jeff FW
That's because when you define unicode(), inside the scope of that function, the name "unicode" is now bound to the function you just defined. So, the line "date = unicode(self.dated)" is calling Letter.unicode() instead of Python's builtin unicode(), and you get an (almost) infinite recursive

Re: ANNOUNCE: Django 1.0 released

2008-09-04 Thread Jeff FW
Thank you all, yet again, for making it feel like the past decade or so that I've been using other languages/frameworks was completely wasted :-) Keep it up, please. -Jeff --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google

Re: Custom validation

2008-07-21 Thread Jeff FW
Sounds like you're looking at the oldforms documentation--that's all been deprecated. Read this instead: http://www.djangoproject.com/documentation/newforms/ Especially this part: http://www.djangoproject.com/documentation/newforms/#custom-form-and-field-validation -Jeff On Jul 21, 8:14 am,

Re: Field representation in n-f-admin

2008-07-18 Thread Jeff FW
If you just want to apply the formatting in the change_list view, then define a method in the class in question that returns the formatted string you want. Then, in the corresponding Admin class, put the name of that function in list_display, and that's it. If you're talking about modifying it

Re: Unique Case Sensitivity

2008-07-16 Thread Jeff FW
Check out: http://dev.mysql.com/doc/refman/5.0/en/case-sensitivity.html However, instead of dealing with it that way, you could also use this: http://www.djangoproject.com/documentation/db-api/#iexact -Jeff On Jul 16, 5:54 am, "Peter Melvyn" <[EMAIL PROTECTED]> wrote: > On Wed, Jul 16, 2008 at

Re: Quick question about switching to newforms-admin branch....

2008-07-16 Thread Jeff FW
According to: http://code.djangoproject.com/wiki/VersionOneRoadmap#must-have-features newforms-admin is a high priority. If you haven't already, take a look at: http://code.djangoproject.com/wiki/NewformsAdminBranch http://code.djangoproject.com/wiki/NewformsHOWTO They're both *really* helpful,

Re: Help with Forms (Dynamic Fields)

2008-07-16 Thread Jeff FW
s.CharField(label=i.name) > > Regards, > Srikanth > > On Jul 15, 7:14 pm, Jeff FW <[EMAIL PROTECTED]> wrote: > > > You have to pass the data into the form when instantiating it, eg: > > form = MyForm(request.POST) > > > However, that means (for your exam

Re: Help with Forms (Dynamic Fields)

2008-07-15 Thread Jeff FW
You have to pass the data into the form when instantiating it, eg: form = MyForm(request.POST) However, that means (for your example), the fields wouldn't exist yet-- move them into __init__ instead. Some other things to note: you don't need to "title" and "email" to the form dynamically--might

Re: modify select widget

2008-07-13 Thread Jeff FW
Misspoke in that last post--if you want a select tag, obviously you won't be using li tags. You'd use option tags, and maybe throw in some text in front of each option to indicate the level. Everything else still applies the same. -Jeff On Jul 12, 11:57 am, Nenillo <[EMAIL PROTECTED]> wrote:

Re: modify select widget

2008-07-13 Thread Jeff FW
I recently had to do something similar. The way I went about it (and I'm not sure this is the best way) is to select all of the categories, then iterate through them and build a tree, using each category's parent_id to figure out where in the tree it fits. Then, once you've got a tree, you have

Re: elusive Post error

2008-07-08 Thread Jeff FW
Are you getting a particular error code, like 501 (not implemented)? I would check Apache's error logs, as the issue might be happening before Django ever gets the request. If nothing useful shows up in those logs, try increasing the logging level. Oh, just a note--you may want to strip secret

Re: deleting a session

2008-07-03 Thread Jeff FW
I haven't tried this (I'll try it when I get home), but looking at the session code shows that you should be able to call: request.session.delete() to delete the whole session at once. On Jul 3, 3:52 am, Daniel Hepper <[EMAIL PROTECTED]> wrote: > Try: > > for key in request.session.keys(): >    

Re: How do I get the value of a disabled Select widget?

2008-07-03 Thread Jeff FW
Why do you need to put the value back into a form? I'm assuming that this is on the second page of a multi-part form, or something along those lines. A safer way to do it might be to store the value in the session, and not rely on the data coming back from the form to be correct. (The user can

Re: url views problem

2008-06-25 Thread Jeff FW
w passed a parameter called show_feed. > > you need to use it accordingly > > > On Jun 24, 10:02 am, sebey <[EMAIL PROTECTED]> wrote: > > > > either way its still the same thanks though but it still is not > > > working > > > > On Jun 24, 1:44 pm,

Re: url views problem

2008-06-24 Thread Jeff FW
The regex you're using has a trailing /, so you need to have that in your link as well: /shows/1/ The other option is to make the trailing slash optional like so: r'^shows/(?P\d{1})[/]?$' On Jun 24, 7:09 am, sebey <[EMAIL PROTECTED]> wrote: > it works but  (thanks for the tips) it still is

Re: method="POST" form problems. Help required

2008-06-21 Thread Jeff FW
Looks like you forgot a return statement in the if statement. Not sure if that would cause what you're seeing, but it certainly couldn't help. -Jeff On Jun 21, 6:46 pm, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote: > I forgot to post the problem. After clicking the 'Login' button, >

Re: Why PostgreSQL?

2008-06-21 Thread Jeff FW
n Sat, Jun 21, 2008 at 10:19 PM, Jeff FW <[EMAIL PROTECTED]> wrote: > > > On Jun 21, 12:46 am, "Russell Keith-Magee" <[EMAIL PROTECTED]> > > wrote: > >> AFAICT, that's the same idea suggested on #3615. The discussion on > >> that ticket describe

Re: Why PostgreSQL?

2008-06-21 Thread Jeff FW
On Jun 21, 12:46 am, "Russell Keith-Magee" <[EMAIL PROTECTED]> wrote: > On Fri, Jun 20, 2008 at 9:14 PM, Jeff FW <[EMAIL PROTECTED]> wrote: > > > I haven't yet used Django's dumpdata and loaddata, but I've used > > mysqldump about a million times. (That's

Re: Why PostgreSQL?

2008-06-20 Thread Jeff FW
I haven't yet used Django's dumpdata and loaddata, but I've used mysqldump about a million times. (That's mostly what we use at my job, though I've been slowly pushing us towards postgres.) Try adding: /*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */; at the