getting request.user into a ModelForm?

2008-11-06 Thread Rob Hudson
I have the following: ## MODELS class Category(models.Model): user = models.ForeignKey(User) name = models.CharField(max_length=200) class Link(models.Model): user = models.ForeignKey(User) category = models.ForeignKey(Category) name = models.CharField(max_length=255) ur

Re: No module named urls

2008-12-03 Thread Rob Hudson
It's odd... I'm getting the exact same error at the exact same spot, running Django trunk r9550. What's strange is that it gets the 500 error on first request, and is ok all subsequent requests. On Nov 26, 9:34 am, TheIvIaxx <[EMAIL PROTECTED]> wrote: > So i've narrowed down the problem more.  I

Re: No module named urls

2008-12-04 Thread Rob Hudson
On Dec 3, 11:01 pm, Malcolm Tredinnick <[EMAIL PROTECTED]> wrote: > This is an area where Django has poor error handling and we're slowly > cutting them down. So you have to do a bit of commenting out and > experimenting on the command line (just try a simple reverse() call each > time to trigger

Re: No module named urls

2008-12-04 Thread Rob Hudson
On Dec 4, 12:59 am, Rob Hudson <[EMAIL PROTECTED]> wrote: > I'll keep poking around a bit and see if I can dig up anything > further. I think I tracked it down... Looking at the tracebacks above, you can see the first time through, it winds up on line 198 which tries to import

Character encoding... latin1 to utf8?

2008-12-04 Thread Rob Hudson
I'm migrating a site to Django. The old site was PHP/MySQL with MySQL having a default encoding of latin1. It seems like there are also Windows 1252 encodings but I'm not sure. I have the old database and the new Django UTF8 one side by side and have a migration script that uses raw MySQLdb to

Re: Character encoding... latin1 to utf8?

2008-12-06 Thread Rob Hudson
Thanks Malcolm, On Dec 4, 6:12 pm, Malcolm Tredinnick <[EMAIL PROTECTED]> wrote: > Now you might well be able to have this happen automatically using the > "unicode" option to MySQLdb -- it knows how to convert between various > server-side encodings and Python unicode. So look at that parameter

Re: Character encoding... latin1 to utf8?

2008-12-06 Thread Rob Hudson
Wow, thanks so much Karen, for slicing and dicing the problem like that. On Dec 6, 10:36 am, "Karen Tracey" <[EMAIL PROTECTED]> wrote: > You could also just convert the character set used on the MySQL side: > > http://dev.mysql.com/doc/refman/5.0/en/charset-conversion.html > > Presumably since My

Re: sys.path trickery in settings.py

2009-01-04 Thread Rob Hudson
I wouldn't say it's frowned upon, per se, but you're making things hard for yourself. Why not add Django to your Python path? There are other ways to go, too... In the shell you're working in: $ export PYTHONPATH=~/pkg/django-trunk Then ./manage.py will find it without editing the file. For my

Re: Migrating MySQL -> Postgre, any working solutions?

2009-01-04 Thread Rob Hudson
I'm working on a project that is doing this and wrote a data migration script. The gist of it is that it connects to the old MySQL database using straight MySQLdb, and connects to the new Postgresql database using Django and the ORM. I iterate over all tables and such and call my ORM methods to

request getlist() in order?

2008-07-16 Thread Rob Hudson
If I have a form like the example: The Beatles The Who The Zombies And I call request.POST.getlist('bands'), is the order of the bands going to always be the same as provided in the select box? Or another case, if I have the form: Select bands in the order you want them to p

Re: request getlist() in order?

2008-07-18 Thread Rob Hudson
Thanks Arien! --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] Fo

Newforms admin and custom widgets

2008-07-18 Thread Rob Hudson
Hello, This is question my get long so I'll post the short version then the longer more detailed version: The short: My goal is provide the user with an autocomplete AJAX widget to quickly look up ISBNs. The ISBNs will end up in a text field in HTML to be sent back to the backend where I'd like

Re: DjangoCon keynote transcript/summary

2008-09-17 Thread Rob Hudson
On Sep 17, 7:29 am, Delta20 <[EMAIL PROTECTED]> wrote: > PS: Does anyone know what Cal was using to show the queries in > Pownce(I think that's what it was)? That looked pretty handy. I don't know what tool it was or if it is available but I started a project with a similar purpose that is gainin

Re: Newforms admin and custom widgets

2008-09-17 Thread Rob Hudson
I was playing with this again tonight and it's just not working for me no matter what I try. I'm wondering if there are issues with ManyToMany and Inlines and trying to override them? On Jul 24, 5:23 pm, "Rob Hudson" <[EMAIL PROTECTED]> wrote: > > SpecialBoo

Any way to avoid the SQL hit of auth_messages?

2008-10-20 Thread Rob Hudson
Hi, I'm wanting to reduce an unneeded query from my page views in my project caused from Django's built-in auth_messages. I'm looking for the best solution to do this while still allowing me to use contrib/ auth and the admin. The source of the query comes from the 'auth' context processor, I b

InternalError and transactions

2009-01-24 Thread Rob Hudson
I'm a bit at a loss as to where to go from here... I have simple Link and Category models. My Link model is essentially: user_id, category (FK), name, URL. I have a Meta unique_together on (user, url) so no duplicate URLs get entered. I'm testing this by trying to purposefully enter a duplicat

Re: InternalError and transactions

2009-01-24 Thread Rob Hudson
On Jan 24, 11:41 am, Karen Tracey wrote: > Just a note -- what you are describing is unique URLs per-user.  You > confused me a bit with how you phrased it as duplicate URLs are allowed by > what you have specified, so long as they are associated with different > users. Right. Sorry for the conf

Re: Django Forms in HTML 4.01 Strict

2009-01-30 Thread Rob Hudson
Here's some food for thought on the subject of HTML 4.01 in Django (as it's been discussed a lot before): James Bennet brought up the HTML4 argument on the Django developers list some time ago: http://groups.google.com/group/django-developers/browse_thread/thread/a233bb5b3b39e147/7c9bf930a533345b

Advice on many to many with too many records in admin

2009-02-14 Thread Rob Hudson
Hi Django Users, I'm setting up a new Django model for a Newsletter app. The newsletter model has a many to many to a Book model that has about 20,000 records. This results in a multiple select box that is unusable for searching/selecting books. I have some ideas on what I can do to make this

Re: Advice on many to many with too many records in admin

2009-02-14 Thread Rob Hudson
On Sat, Feb 14, 2009 at 11:29 AM, Alex Gaynor wrote: > Have you tried using raw_id_fields with it? > http://docs.djangoproject.com/en/dev/ref/contrib/admin/#raw-id-fields Just now tested that out. That works pretty well but the downside is that, for the user, the ID means nothing. It has the l

URL quoting and escaping

2009-03-03 Thread Rob Hudson
At work we wanted to set up some quick clickthru tracking. I whipped up a quick solution that seemed to work on my local machine. The solution was to use jQuery to look for anchor tags who's href started with "http://"; as a signifier of external links, and add a click event to them to direct th

Re: URL quoting and escaping

2009-03-04 Thread Rob Hudson
I decided to follow Google's lead and pass it as a parameter of the query string instead and all is well now. Thanks for the feedback... I never considered it might be the web server. -Rob --~--~-~--~~~---~--~~ You received this message because you are subscribed

Pass a queryset to the admin and display using existing app/model admin?

2009-03-28 Thread Rob Hudson
I have a use case where we want a search form to search across almost all columns of this particular model. Upon submit, I thought it would be a nice feature (since this is already in the admin) to use the already existing settings for my particular app/model instance. Is it possible to build up

TemplateDoesNotExist error when postmortem says it exists?

2009-03-29 Thread Rob Hudson
This is a stumper... I have a very simple view that is a wrapper around the generic view direct_to_template. The loader finds the template as indicated in the output "(File exists)", but yet I still get a TemplateDoesNotExist error. Any ideas? I can go to the Django shell and load it just fine

Re: TemplateDoesNotExist error when postmortem says it exists?

2009-03-29 Thread Rob Hudson
On Sun, Mar 29, 2009 at 8:28 AM, Karen Tracey wrote: > That generally means the permissions don't allow the code to access the > file.  You don't mention if this happens with the dev server (which would > surprise me, since you can load the template from the shell) or only with a > real web serve

Re: TemplateDoesNotExist error when postmortem says it exists?

2009-03-29 Thread Rob Hudson
Wow, that was a tricky one to track down... After putting debug output in django/template/loaders/filesystem.py I saw that filepath was set to: '/Users/rob/git/anglers/anglers/templates/('book/ search_form.html',)' I back tracked that and found that I had a trailing comma in my view code:

Re: debug toolbar problem

2009-11-02 Thread Rob Hudson
It's looking like you have DEBUG=False and rely on request.user.is_superuser to enable the toolbar. Which mostly works, except... The Django Debug Toolbar monkey patches the CursorDebugWrapper class to collect its data about what SQL queries are being executed: http://github.com/robhudson/django

Re: django-tagging is not multi-db safe

2009-12-26 Thread Rob Hudson
> Django-tagging have a lot of users though. Maybe the pinax-people will > arrange for a version that is 1.2-safe. Check out django-taggit: http://github.com/alex/django-taggit -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this gro

Re: django-debug-toolbar with runserver not running on localhost

2010-02-05 Thread Rob Hudson
Or use the SHOW_TOOLBAR_CALLBACK to customize when you want the toolbar displayed... I simply ship with what I consider reasonably safe defaults. For example: # Always show the toolbar DEBUG_TOOLBAR_CONFIG = { 'SHOW_TOOLBAR_CALLBACK: lambda req: True, } # Only show toolbar for super user d

Re: django-debug-toolbar and 404's

2010-02-12 Thread Rob Hudson
Can you test it by disabling the debug toolbar middleware? I've duplicated your exact settings as much as I can and it's working for me. If disabling the middleware makes the admin appear, then it would seem something in the toolbar is causing the problem. And you are right... those settings you

Re: Check if django is getting a page from memcache

2010-02-13 Thread Rob Hudson
You can telnet to memcached and run the `stats` command. That'll tell you overall hits and misses (plus other info). If you're using Django's page caching middleware, you'll see 2 hits per page because Django caches both headers and page content. The page load you should see 2 misses. Then all

Re: robots.txt?

2007-06-05 Thread Rob Hudson
I'm not using mod_rewrite currently (and may even have it turned off in Apache to save memory). Is there another solution? I have my static media folder set in Apache with: SetHandler None Can you do the same for single files? Thanks, Rob On Jun 4, 8:12 am, KpoH <[EMAIL PROTECTED]>

Re: robots.txt?

2007-06-06 Thread Rob Hudson
Great. Thanks for all the help everyone. -Rob On Jun 5, 9:56 am, "Joseph Heck" <[EMAIL PROTECTED]> wrote: > Yes, you'd set in something like: > > >SetHandler None > > > (which is exactly what I've done) > > -joe > --~--~-~--~~~---~--~~ You received this

Re: image bundle for django

2007-06-12 Thread Rob Hudson
I saw this come through on Django snippets and read the GWT page. It's an interesting idea. It's similar to the idea of concatenating JS or CSS files, but with images. I was a little disappointed to see how the demo had to load the 1 big image file before you see any images. I think most people

Pagination

2007-06-21 Thread Rob Hudson
I've set up a list view that I want paginated and I'm using the list_detail generic view. I was thinking that I would prefer the /url/ page2/ URL over /url?page=2 so I set that up. The problem is, in my template where I want to display the prev/next links there's no way that I see to avoid hard

Re: Pagination

2007-06-21 Thread Rob Hudson
On Jun 21, 1:23 pm, Tyson Tate <[EMAIL PROTECTED]> wrote: > Look at "next" and "previous" context variables. You can do: > > Next > > and > > Previous Right, but it's the 'href="/url/..."' part that doesn't feel right to me. If I either want to (a) re-use this template for other URLs (list view

Re: Pagination

2007-06-21 Thread Rob Hudson
> I don't understand. If you're one /foo/bar/baz/page1/, then why can't > you write as the link? It will work, is a > well-formed URL and is independent of the prefix. Note that you must > ensure your URLs are canonicalised if you use this system, though: > always ending with a trailing slash, so

Re: Pagination

2007-06-21 Thread Rob Hudson
Just following up... If you use the query string option, you don't need to know the current url, you can just do this: {% if has_previous %} Previous {% endif %} And the browser fills in the current url path minus any query string and that just appends to it, which is kind of nice.

Template "taglib" library?

2007-06-26 Thread Rob Hudson
Hello, While looking at the Lost Theories source code (thanks Jeff Croft!) I saw he's using what looks like a real handy library called "taglib". I can't find taglib and it may well be a personal library. But one use case caught my eye: In theories/theory_list.html he's defining a "paginator" b

Re: Can't run Django. Getting error message about no module named _md5

2007-06-28 Thread Rob Hudson
Python 2.5 uses hashlib and no longer has a module "md5". There's at least 1 patch dealing with this for users and passwords: http://code.djangoproject.com/ticket/3604 Though the "_md5" doesn't seem right either. -Rob On Jun 27, 6:58 am, jeffself <[EMAIL PROTECTED]> wrote: > Just updated Djang

Re: Django advocacy in a commercial environment

2007-07-19 Thread Rob Hudson
On Jul 19, 1:19 am, "Jon Atkinson" <[EMAIL PROTECTED]> wrote: > If anyone has any good resources which show off the power of Django > (and by association, the benefits of PHP), then please share them with > us. Where I work we migrated away from PHP to Django with great success but it depends on

Re: Blog engine

2007-07-19 Thread Rob Hudson
Why not start a Google code repository and see how many people want to chip in and help. This comes up often enough that it sounds like there's enough interest. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Djan

Re: Blog engine

2007-07-20 Thread Rob Hudson
A lot of the same arguments against making a standard blog project could probably be applied to Rails, but here's a blog app in Rails... http://simplelog.net/ I think an open-source Django blog project would be good because 1) It would be Usable to many (as evidenced by this thread and others bef

Re: Django advocacy in a commercial environment

2007-07-20 Thread Rob Hudson
On Jul 20, 2:09 am, "Jon Atkinson" <[EMAIL PROTECTED]> wrote: > I don't mean to pry, but at your workplace have you had any difficulty > hiring into Python/Django roles at your company (compared to PHP)? Do > you get less applicants? A better quality of applicant? We only have 2 developers and be

MySQL and InnoDB

2007-08-06 Thread Rob Hudson
Hi Django Users, I'm using MySQL with Django but I dislike MySQL's default MyISAM tables because there is no referential integrity. So I googled how to force Django to create InnoDB tables with MySQL and I found that I need to add this to my settings.py: DATABASE_OPTIONS = { "init_co

Re: MySQL and InnoDB

2007-08-07 Thread Rob Hudson
On Aug 6, 4:16 am, Matti Haavikko <[EMAIL PROTECTED]> wrote: > Hi, > > Can you get the same result with "default-storage-engine=InnoDB" in your > my.cnf? > > - Haavikko I believe you can but for other various reasons I'm not able to make this change globally. Does anyone know if adding the DATA

Why isn't my app appearing in the admin?

2007-08-14 Thread Rob Hudson
OK, this is baffling. Tonight I've been working locally adding a new app to my project. I got enough of it going and wanted to publish to my server. So I updated via SVN on my server, ran validate to check for errors, then ran syncdb, the models got installed, I reloaded Apache and logged into

Re: Why isn't my app appearing in the admin?

2007-08-14 Thread Rob Hudson
On 8/14/07, Paul Rauch <[EMAIL PROTECTED]> wrote: > inside the model class, add the class Admin. I forgot to check that explicitly on the server but only because the admin was working locally. That would have been embarrassing though. :) Thanks, Rob --~--~-~--~~~---

Re: Why isn't my app appearing in the admin?

2007-08-14 Thread Rob Hudson
On 8/14/07, Malcolm Tredinnick <[EMAIL PROTECTED]> wrote: > Unless that something is forgetting the inner Admin class, I'll wager > you've bumped into #1796. I *really* need to get myself into gear and > work on that some more. It's embarassing. > > At the moment, there's no known reliable workaro

Map of Django users

2007-08-15 Thread Rob Hudson
I live and work in Eugene, OR and because of the Django Master Class at OSCON I found out that there were a number of other people in Eugene using Django. So I thought it would be nice if there were a map of Django users to see if there were others nearby. To that end, I quickly created a Frappr

What's possible in the admin?

2007-08-18 Thread Rob Hudson
I have a list of things I'd like to do in the admin for a new client but I'm not sure if all of these are possible. I'm hoping those more familiar with admin tweaking could provide a Yes/No for these? I've heard something about how the new admin branch allows for multiple admins, so possibly one

Re: What's possible in the admin?

2007-08-20 Thread Rob Hudson
Thanks for both of the great replies, Malcolm and oggie rob. Much appreciated. -Rob --~--~-~--~~~---~--~~ 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@googlegrou

Django suddenly loses DJANGO_SETTINGS_MODULE running locally

2007-08-28 Thread Rob Hudson
I've had this happen a number of times previously and fixed it by exporting the environment variable, but last night I was running without and env variable using "./manage.py runserver", stopped the server after making some changes and it then complained about the missing environment variable. It

Re: Django suddenly loses DJANGO_SETTINGS_MODULE running locally

2007-08-28 Thread Rob Hudson
On Aug 28, 8:49 am, "Jeremy Dunck" <[EMAIL PROTECTED]> wrote: > manage.py just tries to import the settings module directly; it > basically assumes that '.' is on your sys.path, that "settings" is the > name of your settings module, and that the current working directory > contains the settings mo

Re: Django suddenly loses DJANGO_SETTINGS_MODULE running locally

2007-08-28 Thread Rob Hudson
I didn't dig deeper last night because I was "getting things done" and it was easier to just export the environment and move on. Looking harder at the traceback I noticed it was getting hung up on my putting stuff in the project's __init__.py file which was importing things from Django. It looks

Re: Simple markup language?

2008-01-21 Thread Rob Hudson
Thanks for the reply... I have considered rolling my own along the lines of {{ mytext| striptags|simple_markup }} but thought I'd ask before I went through the effort. In Python there's usually a library for everything. :) I've also looked at the optional arguments to Markdown and Textile and

Simple markup language?

2008-01-21 Thread Rob Hudson
Hi, I'm looking for something along the lines of Textile or Markdown, but with very minimal features. Does anyone know of other projects that might fit these requirements? * Strip all HTML * Only allow for simple markup (bold, italics, headers, lists, URLs or auto-linking URLs) * Do not allow t

Re: Tumblelog - Generic table or combine queries or...?

2008-02-18 Thread Rob Hudson
On Feb 17, 12:50 am, Jamie Pittock <[EMAIL PROTECTED]> wrote: > 2. Use the contenttypes framework and create a generic TumblelogItem > Model that would hold the content_type and ids of all the model items > I'd like to "tumble".  Something like... This is pretty much what JellyRoll does: http://c

Re: Django minify and combine script?

2008-02-24 Thread Rob Hudson
There's also this blog post: http://pedro.valelima.com/blog/2008/jan/17/deploying-compacted-javascript-django/ > > On Sat, Feb 23, 2008 at 8:26 AM, Thierry <[EMAIL PROTECTED]> wrote: > > >  I've recently made the switch from Symfony to Django. > > >  Some interesting code here :) > > >  When sear

newforms-admin questions

2008-03-09 Thread Rob Hudson
How's the stability and/or "readiness" of newforms-admin? I have a project where I'm going to be needing to do some admin tweaking and it sounds like newforms-admin is much more flexible. For example, here are a few things I'm going to be needing to do... * Auto populate a field based on the va

Re: Need Help Thinking Through How to Setup URLS and VIEWS

2008-03-30 Thread Rob Hudson
On Mar 29, 2:54 pm, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote: > Specifically, i need help with: > 1. How do I test to see what a slug is? I.E. In my case, is it a > section or a page. > > Finally, am I barking up the wrong tree? Would it be simpler to just > write a custom view that does what

Re: Problem storing utf-8 in MySQL

2008-04-13 Thread Rob Hudson
On Mar 21, 4:19 pm, "Karen Tracey" <[EMAIL PROTECTED]> wrote: > OK, got it now.  Turns out the answer is in the clear-as-mud error message, > sort of: > > Warning: Incorrect string value: '\xF0\x90\x8C\xBC\xF0\x90...' > > x'f0908cbc' is a valid 4-byte UTF-8 value, only MySQL doesn't support 4-byte

Re: Problem storing utf-8 in MySQL

2008-04-13 Thread Rob Hudson
On Apr 13, 6:26 pm, Malcolm Tredinnick <[EMAIL PROTECTED]> wrote: > Do you mean that you are coming across a case of trying to store 4-byte > UTF-8 sequences in MySQL? Or do you mean that you've managed to create a > database table with the incorrect encoding and only realised this after > you've

auto_add or default or save?

2008-05-25 Thread Rob Hudson
I don't recall where, but I thought I had heard once that the auto_add and auto_add_now options to date fields in models was going away. I've seen 2 main options in the wild and I'm not sure which is preferred... I suppose each has its own use case: 1) Add default=datetime.now to the field. Thi

Re: Timezone conversion

2008-06-14 Thread Rob Hudson
Check out the source of Brian Rosner's project here: http://code.google.com/p/django-timezones/ -Rob On Jun 13, 1:07 am, Darthmahon <[EMAIL PROTECTED]> wrote: > Hi Guys, > > I want to convert a datetime field for an entry in my database to a > specified timezone. Here is the code I have so far:

Re: Inheriting from auth.models.User

2008-07-01 Thread Rob Hudson
On Jun 30, 9:43 pm, Michael Richardson <[EMAIL PROTECTED]> wrote: > > There's a patch for this -http://code.djangoproject.com/ticket/3011 Dangit! Michael beat me to it! :) --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Gr

raising HttpResponseBadRequest throws Exception Type error?

2008-07-05 Thread Rob Hudson
In my code for an API it made sense to me to import and raise `HttpResponseBadRequest ` when the API was given bad data to work with. I'm importing and raising the error like this: from django.http import Http404, HttpResponseBadRequest raise HttpResponseBadRequest, "Invalid data" But w

clean_* method for ModelForms?

2008-07-06 Thread Rob Hudson
Is it possible to supply a clean_[fieldname] method to a ModelForm for custom validation rules like you can with a normal Form? I've got a form with an author column that maps to Django's User class. I want a default to be set if none is given. I've tried many ways to accomplish this and haven'

Re: raising HttpResponseBadRequest throws Exception Type error?

2008-07-06 Thread Rob Hudson
On Jul 5, 7:33 pm, Malcolm Tredinnick <[EMAIL PROTECTED]> wrote: > Having an exception > for every possible response code is really overkill here, since it means > you'll be raising status-code-related exceptions instead of more > semantic ones. Ah, makes sense. > > * Shouldn't Django be consist

Re: clean_* method for ModelForms?

2008-07-06 Thread Rob Hudson
So if I understand correctly, you are saying make author a not-required field so is_valid() will validate to True. Then in my view do the commit=False on save, check if author is present and if not, set the default author, then call save(). Something like that? On Sun, Jul 6, 2008 at 11:35 AM,

Re: Using a Custom Manager for date based generic views??

2008-07-06 Thread Rob Hudson
On Jul 6, 3:53 pm, Christopher Clarke <[EMAIL PROTECTED]> wrote: > class IssuerManaager(models.Manager): > >      def with_aggs(self): >          from django.db import connection >          cursor=connection.cursor() >          cursor.execute(""" >              select i.id,max(i.name), m.dateix AS

Re: Calendar of Events

2008-07-07 Thread Rob Hudson
Google is your friend: http://code.google.com/p/django-event-calendar/ On Jul 7, 2:13 pm, Mario <[EMAIL PROTECTED]> wrote: > Hello, > > I’m a NOOB and I was wondering if there are any calendars of event > model that will allow a user to click on a specific date with the > associated listing of ev

Re: In admin, unable to save many-to-many relation objects with intermidiate table

2008-07-09 Thread Rob Hudson
I just bumped into this last night and found that having core on the ForeignKey field cause it to not save the record. Try removing core=True and see if that helps. -Rob On Jul 8, 6:02 pm, "ristretto.rb" <[EMAIL PROTECTED]> wrote: > Hello, I'm stuck.  Any help will be much appreciated. > > I >

Re: accessing a model ojbect's saved fields

2008-07-09 Thread Rob Hudson
Could you override the save method and remove the file from the filesystem prior to saving? e.g. class MyModel(models.Model): ... def save(self): if self.id: # is a record in the database # file system unlink call to self.path super(MyModel, self).save() -Ro

Re: Arbitrary precision arithmetic in django

2008-07-09 Thread Rob Hudson
FloatField? http://www.djangoproject.com/documentation/model-api/#floatfield On Jul 9, 4:02 am, shabda <[EMAIL PROTECTED]> wrote: > I need to do some Financial calculations in an app in Django. > models.DecimalField is fixed precision, while I need an arbitrary > precision field. How can I do thi

Re: Black Box Testing Framework for Django

2008-07-09 Thread Rob Hudson
I've seen articles using Twill: http://twill.idyll.org/ And Selenium for Javascript testing: http://selenium.openqa.org/ I'm pretty sure Twill would meet your definition of "Black Box Testing" since it has no knowledge of the internals of the Django app you are testing. -Rob On Jul 8, 10:55 pm

Re: Generic delete view.

2008-07-09 Thread Rob Hudson
It took me a minute to see it, but "str object not callable" is referring to the fact that your URL pattern is providing a string as its 2nd argument and "delete_object" (the string) cannot be imported and called. You can either: 1) Use the actual view you imported (i.e. remove the single quotes

Re: Arbitrary precision arithmetic in django

2008-07-09 Thread Rob Hudson
On Jul 9, 8:07 am, Malcolm Tredinnick <[EMAIL PROTECTED]> wrote: > Rob, I am never letting you do my financial programming for me. Float > fields lose precision. Inexact. Approximate. Heh. Sorry. I was misunderstanding "arbitrary". Yeah, don't listen to me, obviously. :) --~--~-~--~--

User profile and sliding date range data model?

2007-03-29 Thread Rob Hudson
I'm trying to think how I can solve this problem in my data model and I'm coming up empty. I thought I'd post it here to see if anyone else had a good idea... I built a members-only website for due paying members. We'd like to use the profile via the Django admin as a way to track which memb

Re: User profile and sliding date range data model?

2007-03-30 Thread Rob Hudson
James Bennett wrote: > On 3/29/07, Rob Hudson <[EMAIL PROTECTED]> wrote: >> I can't think of a way to account for "up to last 3 years" and "up to >> the next 5 years" or variation thereof. > > paid_up_until = models.DateField() > >

On more efficient use of QuerySets

2007-04-04 Thread Rob Hudson
Fellow Djangonauts, Here at my work[1] we've built a number of web-based educational websites in Django now. I'm analyzing the number of SQL calls and am realizing that the number is higher than I'd like. My main question is around whether or not I can do a bulk query to get most of the data

Re: On more efficient use of QuerySets

2007-04-04 Thread Rob Hudson
James Bennett wrote: > The 'select_related' method[1] may be what you're looking for; it > selects related objects up-front in the same query, so that later > access doesn't go back and hit the DB again. Yes, I'm doing this where it makes sense. What I'm looking for is whether there is a way to

Offline Django Apps

2007-05-22 Thread Rob Hudson
I have a need for a way to run Django-based websites offline as an installable application. I recently read about Joyent Slingshot: http://developer.joyent.com/ I'm curious if there are others who could use this functionality but for Django. If so, perhaps we can all collaborate and come up wit

Re: Offline Django Apps

2007-05-22 Thread Rob Hudson
Cool. What's the best way to coordinate the effort? A wiki page to start with? Coming up in the next month or so I'm going to have to dedicate work time to this but for now I'd like to just lay out the groundwork and do it in such a way that it benefits the Django community. 1) Cross Platform

Re: Stagnating Djangobook? Broken Atom feed?

2007-05-30 Thread Rob Hudson
I was kind of wondering the same... is the Django Book going to align with Django 1.0? --~--~-~--~~~---~--~~ 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@googlegr

Re: Offline Django Apps

2007-05-31 Thread Rob Hudson
On May 31, 1:20 am, "Vagmi Mudumbai" <[EMAIL PROTECTED]> wrote: > Check out Google Gears.http://gears.google.com There's a lot of interesting things about Google Gears... It provides a browser local SQLite accessible via Javascript. It provides a local HTTP server for storing/retrieving cached

robots.txt?

2007-06-04 Thread Rob Hudson
What do most people do for a robots.txt file in Django? I set up my website to email me errors and 404s, and I often get a 404 email for the robots.txt. Thanks, Rob --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups

Re: Django deployment à lá Capistrano

2007-09-11 Thread Rob Hudson
On Sep 8, 10:47 am, Chris Hoeppner <[EMAIL PROTECTED]> wrote: > This is just to make it a bit more obvious. I've decided to make up a > python application similar to Capistrano, for Django. I'll just echo here that yes, I'd be very interested in this. It's on my queue to learn Capistrano as a de

Re: Django deployment à lá Capistrano

2007-09-11 Thread Rob Hudson
On Sep 11, 9:20 am, "Alvaro Mouriño" <[EMAIL PROTECTED]> wrote: > Capistrano is: > * A saint:http://en.wikipedia.org/wiki/Giovanni_da_Capistrano > * An Italian city:http://en.wikipedia.org/wiki/Capistrano_%28VV%29 > * A city in > California:http://en.wikipedia.org/wiki/San_Juan_Capistrano%2C_Cali

Does setting a session cause a redirect?

2007-10-03 Thread Rob Hudson
I'm working on an advanced search feature for a website and am using request.session to store the search terms so pagination will remember and paginate correctly. While working with the built-in server I'm seeing that my search submit come through as a POST then almost immediately after I see ano

Re: Does setting a session cause a redirect?

2007-10-03 Thread Rob Hudson
After the few responses here and Malcolm telling me I was on drugs (grin) I dug deeper and found the problem... On my list result page I had a model method returning an empty string for a URL to a related image which resulted in the following HTML: That cause an extra GET request to the sa

Re: Problem with Pagination

2007-10-19 Thread Rob Hudson
I don't think it's 100% to your specs but take a look at this: http://blog.localkinegrinds.com/2007/09/06/digg-style-pagination-in-django/ It's close enough for tweaking to get you 95% of the way there (maybe). --~--~-~--~~~---~--~~ You received this message beca

Templates, filesystem, caching?

2007-12-17 Thread Rob Hudson
Howdy, A thought occurred to me today and I'm not 100% sure what Django does by default... Similar to the idea that PHP parses scripts for each request and having an opcode cache can increase performance, I'm wondering if Django reads templates from the file system, parses them, and then does th

Re: Templates, filesystem, caching?

2007-12-17 Thread Rob Hudson
On 12/17/07, Alex Koshelev <[EMAIL PROTECTED]> wrote: > > http://www.djangoproject.com/documentation/cache/ If I understand correctly, these cache the templates after they have been rendered. What I'm curious about is if there is a way to cache templates before they are rendered so you can provi

Re: Templates, filesystem, caching?

2007-12-18 Thread Rob Hudson
On 12/18/07, Michael Elsdörfer <[EMAIL PROTECTED]> wrote: > James Bennett schrieb: > > Manually call get_template() or select_template(), and stuff the > > resulting Template object into a module-global variable somewhere. > > Then just re-use it, calling render() with different contexts, each > >

Re: Templates, filesystem, caching?

2007-12-21 Thread Rob Hudson
Awesome! What happens if you don't have caching enabled? On 12/21/07, SmileyChris <[EMAIL PROTECTED]> wrote: > > After reading this thread the other day, I decided to write up a patch > [1]. > > [1] http://code.djangoproject.com/ticket/6262 --~--~-~--~~~---~--~~

Re: Templates, filesystem, caching?

2007-12-22 Thread Rob Hudson
On 12/21/07, Malcolm Tredinnick <[EMAIL PROTECTED]> wrote: > In the early days of Django, Adrian, Simon et al looked at that. It > wasn't worth it, since, in the grand scheme of things, template caching > and checking the cache wasn't that much faster than loading and parsing, > particularly in th

Re: Templates, filesystem, caching?

2007-12-23 Thread Rob Hudson
On 12/23/07, Eratothene <[EMAIL PROTECTED]> wrote: > Your snippet requires to restart django each time the templates have > changed. Did you try to add checking of template file modification > date in order automatically invalidate cache? What it is performance > of such implementation? Adding thi

Re: models wierdness

2006-09-18 Thread Rob Hudson
Thanks for the reply. :) --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL

Generalized questions as forms and user response handling?

2006-09-18 Thread Rob Hudson
Hi fellow Django users, I'm coming up on a phase of a project where I need to do a lot of work with Forms and Manipulators. I've got some historical bits of old CMS ideas that I'm trying to work with. I wanted to ask Django-users if this approach seems reasonable, or if another approach woul

  1   2   3   >