Speeding up the tests, what am I missing?

2009-01-06 Thread Todd O'Bryan
So, I've been trying to speed up tests. Surprise. I came across a fairly easy solution, so I'm sure I must be missing something. If someone could tell me what I'm missing, I'd really appreciate it. So, first I created my own subclass of django.test.TestCase: class MyTestCase(django.test.TestCase

Re: Speeding up the tests, what am I missing?

2009-01-06 Thread Todd O'Bryan
On Tue, Jan 6, 2009 at 6:05 PM, Malcolm Tredinnick wrote: > > On Tue, 2009-01-06 at 14:51 -0500, Todd O'Bryan wrote: > [...] > >> So, what am I missing? I know this doesn't deal with doctests--the db >> gets cleaned for all of those, but does anyone see when t

Re: Speeding up the tests, what am I missing?

2009-01-06 Thread Todd O'Bryan
On Tue, Jan 6, 2009 at 6:23 PM, Russell Keith-Magee wrote: > > On Wed, Jan 7, 2009 at 4:51 AM, Todd O'Bryan wrote: >> >> So, I've been trying to speed up tests. Surprise. I came across a >> fairly easy solution, so I'm sure I must be missing somethin

Re: ManyToManyField contains

2008-08-18 Thread Todd O'Bryan
I seem to keep making this mistake, even though I know better. contains only works for strings. In other words, it checks to see if a string field contains the substring you provide. You want to use the reverse relationship from the user, rather than a query: myUser = User.objects.get(username='

absolute_import, app names, dots, and a bug

2009-01-25 Thread Todd O'Bryan
I've been trying to convert my apps to use the relative imports from __future__ and have noticed a problem. I think it may be something Django is doing, but I'm not sure. In the __init__.py module inside an app, I have from __future__ import absolute_import from ..another_app.models import blah

Re: absolute_import, app names, dots, and a bug

2009-01-28 Thread Todd O'Bryan
On Sun, Jan 25, 2009 at 7:13 PM, Karen Tracey wrote: > On Sun, Jan 25, 2009 at 7:03 PM, Todd O'Bryan wrote: >> >> I've been trying to convert my apps to use the relative imports from >> __future__ and have noticed a problem. I think it may be something >&

Re: absolute_import, app names, dots, and a bug

2009-01-29 Thread Todd O'Bryan
On Wed, Jan 28, 2009 at 11:49 PM, Malcolm Tredinnick wrote: > > On Wed, 2009-01-28 at 22:50 -0500, Karen Tracey wrote: >> >> No, I don't think that's an accurate representation of the status. >> The triage state is Accepted and furthermore Malcolm even assigned it >> to himself, meaning he's inte

Re: Three table Lookup Question

2009-01-29 Thread Todd O'Bryan
I'm not sure I understand what you're asking, but projs = Project.objects.filter(campaign__industry=x) where x is one of 1-6 should do what you want, I think. Is that what you were asking? On Thu, Jan 29, 2009 at 9:54 AM, Kyle wrote: > > Hello! > > I am trying to get a list of "Projects" base

reason for missing readline() in uploaded files?

2009-01-29 Thread Todd O'Bryan
I'm trying to validate an uploaded csv file, so I want to read the first line of text and if it's not the right format, send an error message. Unfortunately, neither InMemoryUploadedFile nor TemporaryUploadedFile have the readline() method. Was that an oversight (in which case I'll create a two-l

Re: reason for missing readline() in uploaded files?

2009-01-29 Thread Todd O'Bryan
On Thu, Jan 29, 2009 at 9:28 PM, Malcolm Tredinnick wrote: > > On Thu, 2009-01-29 at 15:40 -0500, Todd O'Bryan wrote: >> I'm trying to validate an uploaded csv file, so I want to read the >> first line of text and if it's not the right format, send an error &

Re: Session Variables as Default Form Values

2009-01-30 Thread Todd O'Bryan
You can pass data to a form class as a dictionary, so just save a dictionary of the values in your session under some name that you'll know to use. On Fri, Jan 30, 2009 at 5:04 PM, Tyler Brownell wrote: > http://groups.google.com/group/django-users/browse_thread/thread/ed74391560c762bb > > On Fr

Re: Basic question: filtering objects by date

2009-02-01 Thread Todd O'Bryan
How about: items = Item.objects.filter(categories=category, expire_date__gt=today) ? Todd On Sun, Feb 1, 2009 at 2:04 PM, KJ wrote: > > Hi, I want to filter objects based on whether they have expired or > not. Each object has an expiration date. Right now, I am getting all > the objects via t

Re: trouble with Django and javascript

2009-02-01 Thread Todd O'Bryan
In addition to displaying the message, it's also submitting the form, so you see the text for a second and then the form reloads. Change the instead of "submit" and see if that helps. Todd On Sun, Feb 1, 2009 at 6:05 PM, min wrote: > > First I have a form: > > class TestForm(forms.Form): >

Convenient way to get dynamic names for formset fields?

2009-03-08 Thread Todd O'Bryan
I'm trying to create multiple choice questions with variable numbers of answers. I have a Question model and an Answer model with a ForeignKey back to Question. I'd like to display the question in a form as: Text : ___ A: ___ B: ___ C: ___ D: ___ E: ___ where each blank

Date and time formats

2007-06-08 Thread Todd O'Bryan
Is there an easy way to convert from the format strings the template language uses for the date filter and the strings Python's strftime method uses? Here's where this comes up. We're pre-populating a value in a form with datetime.now() and then using form.as_table() in the template. The time is

Re: sleep for 30 minutes?

2007-06-10 Thread Todd O'Bryan
On Sun, 2007-06-10 at 18:03 +, MartinWinkler wrote: > Hi all, > > I have implemented a captcha solution for django (because the already > available approaches did not fit my needs), and came to this problem: > > An image is created for every captcha-enabled form that is being > displayed. We

Re: Doing query with 'ne' terms.

2007-06-14 Thread Todd O'Bryan
Django uses different functions for this. To get the opposite of this (the ne version) Foo.objects.filter(bar__exact='something') do Foo.objects.exclude(bar__exact='something') HTH, Todd On Fri, 2007-06-15 at 11:37 +0800, Nicholas Ding wrote: > I found Django can not do '<>' operation in SQL,

Re: Doing query with 'ne' terms.

2007-06-14 Thread Todd O'Bryan
I were using exclude, the SQL must be 'where not (column1 = %s and > column2 = %s), that's different. > > On 6/15/07, Todd O'Bryan <[EMAIL PROTECTED]> wrote: > > Django uses different functions for this. To get the opposite > of this

Path problems

2007-06-15 Thread Todd O'Bryan
Hey all, I'm trying to deploy a project I've been developing for a long time and, in preparation, have tried to move everything (including settings.py, etc.) into one overarching module. So, here's my setup: /dmi __init__.py manage.py (which I realize I now can't use) set

Re: Path problems

2007-06-15 Thread Todd O'Bryan
of the views modules that was giving me grief. Bingo, the evil import statement appeared. On Fri, 2007-06-15 at 09:33 -0400, Todd O'Bryan wrote: > Hey all, > > I'm trying to deploy a project I've been developing for a long time and, > in preparation, have tried to

Re: why won't my wildcard url work?

2007-06-15 Thread Todd O'Bryan
On Fri, 2007-06-15 at 11:44 -0700, [EMAIL PROTECTED] wrote: > I've got urls that could be /section/foo/slug/, /section/bar/slug/, / > section/whatever/slug/, so I'm trying to use a wildcard selector > (http://www.djangobook.com/en/beta/chapter03/#s-wildcard-urlpatterns) > > I've tried lots of dif

Re: error after updating from svn (v5479): unexpected keyword argument 'max_digits'

2007-06-15 Thread Todd O'Bryan
On Fri, 2007-06-15 at 22:40 +, hotani wrote: > Full error: > [__init__() got an unexpected keyword argument 'max_digits'] > > Just updated from svn today and when I tried a syncdb that is what > happened. Is 'max_digits' not allowed anymore? > > Here is an example straight from the model: >

Re: Using reverse() in your urlpatterns

2007-06-26 Thread Todd O'Bryan
On Tue, 2007-06-26 at 19:58 +, Justin wrote: > On Jun 26, 12:12 pm, Justin <[EMAIL PROTECTED]> wrote: > > I'm wondering though, is it possible to use reverse() and pass it some > > args, to use it as the post_save_redirect in generic views? > > On second thought, this is kind of a stupid thin

YUI tags

2007-07-04 Thread Todd O'Bryan
I just looked at YUI yesterday and am pretty impressed. What I'm not impressed by is how complicated it is to write the markup in HTML for things like menus so that they'll work in non-JavaScript environments. I'm considering trying to develop a yuitags app that would just consist of template tag

Re: YUI tags

2007-07-05 Thread Todd O'Bryan
Thanks! I'd actually thought about how to do this, but it's nice to have real code... On Thu, 2007-07-05 at 13:50 -0500, Jacob Kaplan-Moss wrote: > Hi Todd -- > > You might find writing those "nested" template tags a bit tricky; > there's a not-very-well-documented method you'll need to pull out

TextField in newforms

2007-07-06 Thread Todd O'Bryan
Is there any reason there's not a TextField in newforms that defaults to use a TextArea widget other than the fact that no one has written one yet? Todd --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users

Re: TextField in newforms

2007-07-06 Thread Todd O'Bryan
On Fri, 2007-07-06 at 11:00 -0500, James Bennett wrote: > On 7/6/07, Todd O'Bryan <[EMAIL PROTECTED]> wrote: > > Is there any reason there's not a TextField in newforms that defaults to > > use a TextArea widget other than the fact that no one has

cross-table unique_together?

2007-07-06 Thread Todd O'Bryan
I'm writing an app to deal with checking out textbooks to students. The models are Title: the book PurchaseGroup: when purchased and how much they cost, foreign key to Title Copy: number, foreign key to PurchaseGroup I'd like to make it so that no two copies have the same

Re: cross-table unique_together?

2007-07-06 Thread Todd O'Bryan
On Fri, 2007-07-06 at 21:50 +, Nathan Ostgard wrote: > You would either have to duplicate the Title foreign key in the Copy > model or write a custom check in the save method. > > To enforce uniqueness over several columns you would use the > "unique_together" field of the Meta class for your

Re: Building forms by hands

2007-07-07 Thread Todd O'Bryan
On Sat, 2007-07-07 at 12:36 +, Alexander Solovyov wrote: > On 5 июл, 14:19, "Russell Keith-Magee" <[EMAIL PROTECTED]> wrote: > > > Can you explain your problem another way, possibly with a more > > complete example? > > Ok, I'll try. > > I want to enter HTML by hands, but can't determine wh

Re: Unexpected keyword argument when calling a function

2007-07-07 Thread Todd O'Bryan
According to the code I have, this should be working. Try changing it to def showcollection(request, manufacturer_id=None, collection_id=None): and see if that makes any difference. On Sat, 2007-07-07 at 16:07 -0700, Greg wrote: > Hello, > I have the following line in my urls.py file > > r'^(

Do FormFields know which Model Field they're from?

2007-07-12 Thread Todd O'Bryan
The docs for newforms say how to override a field if you wish: http://www.djangoproject.com/documentation/newforms/#overriding-the-default-field-types > For example, if you wanted to use MyDateFormField for any DateField > field on the model, you could define the callback: > > >>> def my_callba

Re: Using Django without database

2007-07-12 Thread Todd O'Bryan
On Fri, 2007-07-13 at 01:40 +, Patrick wrote: > Unfortunately, I can't give you more details about the security aspect, > except that it has to do with prolonged physical storage of large amounts > of data online, which is "insecure". The exact details are not known to > me yet. I'm a deve

Re: Do FormFields know which Model Field they're from?

2007-07-12 Thread Todd O'Bryan
On Fri, 2007-07-13 at 09:53 +0800, Russell Keith-Magee wrote: > > Check the attributes of field - amongst many others, there is > field.name, the name of the field on the form. So, you can do the > following: > > if isinstance(field, models.DateField) and field.name == 'appointment': >...

Re: Do FormFields know which Model Field they're from?

2007-07-12 Thread Todd O'Bryan
list.) Thanks Russ! Now back to your program... Todd On Thu, 2007-07-12 at 23:22 -0400, Todd O'Bryan wrote: > On Fri, 2007-07-13 at 09:53 +0800, Russell Keith-Magee wrote: > > > > > Check the attributes of field - amongst many others, there is > > field.name, the name of

Re: Looking for 2 great python/django developers in Atlanta area

2007-07-13 Thread Todd O'Bryan
On Sat, 2007-07-14 at 13:46 +1000, Malcolm Tredinnick wrote: > Umm... the world is a fairly big place. Where in it are you located? > > Malcolm See subject. :-) --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Dj

Adding permission in admin causes error

2007-07-20 Thread Todd O'Bryan
In the most recent from trunk, I get the following error when I try to add a permission (either default or custom) to a user. Is this a bug or am I doing something wrong? Todd TypeError at /dmi/admin/auth/user/2/ Cannot resolve keyword 'name' into field. Choices are: groups, user_permissions, lo

Is this a test? Is this only a test?

2007-07-30 Thread Todd O'Bryan
Some of my pages fetch data based on user input. It obviously doesn't make sense to do the actual fetch in test cases, since I should know what is going to be returned and should be checking for what I do with the data. Is there an easy way to tell if something is running as a test so that I can

equality weirdness

2007-08-01 Thread Todd O'Bryan
I was writing some unit tests for a model in which I'd written a custom __cmp__ method and got a strange result. Is it a bug, feature, or just something to warn people about. django.db.models.Model defines __eq__ and __ne__ based on PK identity. That means that all model objects are == to one an

How do you set user permissions in test data?

2007-08-03 Thread Todd O'Bryan
I've been using fixtures to create test data, but how do I set user permissions that aren't brittle? If I use ./manage.py dumpdata it dumps the user_permissions as a list of ids of permissions the user has. The problem is, as I add more apps/permissions to my project, those ids are likely to cha

Access request while cleaning fields

2007-08-05 Thread Todd O'Bryan
I'm trying to translate a Change Password page I wrote using oldforms into newforms and have hit a snag. I need to validate that the user types in his/her current password correctly and it seems like writing a clean_current_password() method in the form class is the easiest way to do that, since e

Re: Access request while cleaning fields

2007-08-05 Thread Todd O'Bryan
s. Todd On Sun, 2007-08-05 at 10:08 -0400, Todd O'Bryan wrote: > I'm trying to translate a Change Password page I wrote using oldforms > into newforms and have hit a snag. I need to validate that the user > types in his/her current password correctly and it seems like writing a &

Adding permissions in a fixture

2007-08-13 Thread Todd O'Bryan
I asked this before and no one answered, but after having to do this manually in the shell for about the fifteenth time, I'm going to ask again. Is there a way to add user permissions to a test fixture that isn't brittle? Let me outline what I'm doing and see if I'm doing something wrong: 1. I

Re: Adding permissions in a fixture

2007-08-13 Thread Todd O'Bryan
On Tue, 2007-08-14 at 08:27 +0800, Russell Keith-Magee wrote: > On 8/14/07, Todd O'Bryan <[EMAIL PROTECTED]> wrote: > > > > I asked this before and no one answered, but after having to do this > > manually in the shell for about the fifteenth time, I'm goi

Re: Help installing Psycopg2 and/or MySQL-python on OS X

2007-09-02 Thread Todd O'Bryan
On Sun, 2007-09-02 at 16:04 -0700, Brandon Taylor wrote: > Hi everyone, > > I have Python 2.5.1 and Django installed and running on OS X 10.4.10, > but can't seem to get either the Psycopg2 or MySQL-python bindings > installed so I can actually use a database with Django. > > I have the latest v

Re: Help installing Psycopg2 and/or MySQL-python on OS X

2007-09-02 Thread Todd O'Bryan
Looks like you're missing some header files... On Sun, 2007-09-02 at 16:14 -0700, Brandon Taylor wrote: > Hi Todd, > > Here is a copy of my terminal session: > > running install > running build > running build_py > running build_ext > Warning: /bin/sh: line 1: pg_config: command not found Mayb

Re: How to bind data to a form, and not make the validation fire

2008-01-06 Thread Todd O'Bryan
On Jan 6, 2008 11:27 AM, shabda <[EMAIL PROTECTED]> wrote: > > But I need the initial data to be dynamic, so I can't just do > text = forms.CharField(widget = forms.Textarea, initial = 'sometext') > > I assume I can do some thing along the lines of overriding __init__ > for this form, passing the

Re: IE error when clicking the back button after a POST

2008-01-21 Thread Todd O'Bryan
Generally, you use GET when you're retrieving information from the server and POST when you're sending information to the server (as when you're submitting a form). Django is designed so that, if you have GETs and POSTs for a form go to the same URL, you can display the form on the GET branch and

GSoC idea for Django-friendly static checkers

2008-03-29 Thread Todd O'Bryan
Sorry I'm so late suggesting this, but... Do people have a desire/see a need for a way to make Pylint or PyChecker handle Django code more robustly? Because so many of the attributes of Django model and form objects are given as class objects or are auto-generated in instance creation, using a sta

Re: Using Django for Teaching

2008-03-30 Thread Todd O'Bryan
Sorry this is two weeks late (it's been a bear of a two weeks), but I use Django with high school students who've done the equivalent of a year of college programming--the AP Computer Science AB curriculum. We've been working on a webapp for two years that has evolved into something with 8 apps, t

Re: Using Django for Teaching

2008-03-31 Thread Todd O'Bryan
On Mon, Mar 31, 2008 at 12:46 AM, Kenneth Gonsalves <[EMAIL PROTECTED]> wrote: > > > On 31-Mar-08, at 9:58 AM, Todd O'Bryan wrote: > > > Sorry this is two weeks late (it's been a bear of a two weeks), but > > I use Django with high school students who

Re: middleware that works with Ajax

2008-04-09 Thread Todd O'Bryan
On Wed, Apr 9, 2008 at 6:54 AM, Russell Keith-Magee <[EMAIL PROTECTED]> wrote: > > On Wed, Apr 9, 2008 at 1:47 AM, andy baxter > <[EMAIL PROTECTED]> wrote: > > > > Do you mean middleware specifically written for django? If so not sure, > > but it might be worth looking at dojo (http://www.dojoto

Re: files xls

2008-04-09 Thread Todd O'Bryan
There's also xlrd: http://www.lexicon.net/sjmachin/xlrd.htm On Wed, Apr 9, 2008 at 1:23 PM, Claudio Escudero <[EMAIL PROTECTED]> wrote: > Thanks, > > I liked it. > =) > > I did that tips for using pyExcelerator with the django > Http://www.developer.com/lang/other/article.php/3727616 > > On Wed,

Re: Django learning management application

2008-05-14 Thread Todd O'Bryan
My students and I are working on a Django system for online quizzes. It should be finished sometime this summer. I'll post a link when we finish it. Todd On Wed, May 14, 2008 at 10:35 PM, Ariel Mauricio Nunez Gomez <[EMAIL PROTECTED]> wrote: > Moodle and Django can coexist happily (Using same da

Re: syncdb on linux problem

2007-02-17 Thread Todd O'Bryan
It could be as simple as a PythonPath problem. Have you tried running the offending code in the Python shell by using python manage.py shell to see if you can figure out what's going wrong? On Sat, 2007-02-17 at 19:24 -0800, johnny wrote: > I have moved my folder from Windows to Linux. It work

Bug in admin's Change Password form?

2007-03-01 Thread Todd O'Bryan
Using the latest from trunk, I get an error when I try to change a user's password in the admin: -- Traceback (most recent call last): File "/usr/lib/python2.4/site-packages/django/core/servers/basehttp.py", line 272, in run self.result = application(self.environ, self.start_response)

Re: Page Not Found 404

2007-03-06 Thread Todd O'Bryan
We'd have to see your view code (and probably urls.py) to know what was causing this... On Tue, 2007-03-06 at 15:29 +, [EMAIL PROTECTED] wrote: > Dear all, > > I am making simple blog for myself using Django. After made models and > create necessary urls, I run the application and got: Page

disorderly order_by

2007-03-06 Thread Todd O'Bryan
I have these two models: class GradeBookColumn(models.Model): assignment = models.ForeignKey(Assignment, related_name='grade_book_columns') section = models.ForeignKey(Section) when_assigned = models.DateTimeField(blank=True, null=True) when_due = models.DateTimeF

Upload Files (was: Re: Please)

2007-03-06 Thread Todd O'Bryan
This is kind of quick and dirty, but I think it does the job. Someone can correct me if I'm wrong. There may be an easier way; I haven't looked at this since last fall. You need a form with a file upload in it: Upload a new file: Then you need to create view code to catch the file: if req

Re: disorderly order_by

2007-03-07 Thread Todd O'Bryan
Ahhh. The real, honest-to-goodness *table* name in the db. Thanks! On Tue, 2007-03-06 at 21:39 -0300, Ramiro Morales wrote: > On 3/6/07, Todd O'Bryan <[EMAIL PROTECTED]> wrote: > > > I'm trying to get all the grades that belong to a certain student in a > >

Re: WHAT IS DJANGO?

2007-03-14 Thread Todd O'Bryan
The Django you're looking for is here: http://webpages.charter.net/django/ It's apparently a program for printing tablature for various fretted instruments. This Django is a framework for writing applications on the web. On Wed, 2007-03-14 at 13:51 -0700, DICK wrote: > I AM NEW TO THIS SITE AN

newforms with no pre-set number of fields

2007-03-16 Thread Todd O'Bryan
I'm trying to design a form for multiple choice questions: Question: Answer A: Answer B: Answer C: Correct Answer: A B C... Explanation: The problem is that I don't want to fix the number of possible answers so tha

Re: newforms with no pre-set number of fields

2007-03-16 Thread Todd O'Bryan
On Fri, 2007-03-16 at 17:41 +, Rubic wrote: > Just use a ChoiceField with a radio or checkbox widget. > > http://www.djangosnippets.org/snippets/26/ > > -- > Jeff Bauer > Rubicon, Inc. Sorry, wasn't clear. I know how to do it if the question has already been created. My problem is how to

Wiki account

2007-03-16 Thread Todd O'Bryan
I just edited a Wiki page and maybe I'm dense, but I couldn't figure out how to create an account, so I had to do it anonymously. Is there a way to get a Trac account or are those reserved for the nobility? Todd --~--~-~--~~~---~--~~ You received this message be

IRC

2007-03-19 Thread Todd O'Bryan
I'm trying to use XChat to connect to the IRC channel, but I can only find #django-br and #django-fr on FreeNode. What am I stupidly doing? Todd --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group

How to handle a preview page

2007-03-23 Thread Todd O'Bryan
I'm trying to create the following workflow for a website where teachers can create questions for their students: 1. The teacher click a link to create a new question. 2. A form appears where the teacher can enter information, including formatting information in some kind of wiki-like language. A

Re: How to handle a preview page

2007-03-24 Thread Todd O'Bryan
On Sat, 2007-03-24 at 08:41 +1100, Malcolm Tredinnick wrote: > Quite often, preview and edit are combined on the same form, so you see > the preview version at the top and the editable fields lower down. If > you do this, your single form (for edit/create) just needs a block at > the top that con

Re: Newbie problem with view/model interaction

2007-03-24 Thread Todd O'Bryan
What is it you want to do with the ones they've voted on vs. haven't? If you're going to hide the ones they've already voted on, just write a query in the view method that only returns those and pass that to the context. (Note: the view method, not the template. See Ivan's response.) If they have

Re: Announcing Django 0.96!

2007-03-24 Thread Todd O'Bryan
Django gets installed in your Python version's site-packages folder--/usr/lib/python2.x/site-packages is typical for Linux. Probably the easiest thing to do is delete the django folder you find there and re-install. Todd On Sat, 2007-03-24 at 13:14 -0700, mariuss wrote: > On Mar 23, 5:13 pm, "ma

Drop-down choice or create new; how to handle?

2007-04-10 Thread Todd O'Bryan
We've discovered in a couple of places that we need the ability for people to choose something from a list or to create a new item. In the admin, creating a new item involves having a pop-up open, but we'd like to avoid that, if possible. We've kind of decided on a "Create new..." item in the lis

Re: Which ajax framework django will support in the upcoming 1.0, prototype/dojo/jquery?

2007-04-10 Thread Todd O'Bryan
On Tue, 2007-04-10 at 18:11 +, Steve Bergman wrote: > But Django definitely has a preferred ORM and a preferred templating > engine. Why be so set on complete agnosticism when it comes to > javascript? > I agree. I don't have time to weigh the benefits of various libraries. As someone mentio

Re: Global model/view best practice help

2007-04-10 Thread Todd O'Bryan
On Tue, 2007-04-10 at 22:21 +, Dave wrote: > I could add to the Context object in each view, but that's a lot of > repeat code (urgh). Also, if I were to take that route, I'd need the > Model to be available between multiple apps within a project and I've > not seen how to do that. You want

Re: Simple python question

2007-04-10 Thread Todd O'Bryan
On Tue, 2007-04-10 at 17:50 -0500, Jeremy Dunck wrote: > On 4/10/07, Grupo Django <[EMAIL PROTECTED]> wrote: > > > > I know this is not the right place for asking about python, but it's a > > simple question. > > I need to load an object given in a string. Example: > > > > #I have a class called f

Re: Simple python question

2007-04-10 Thread Todd O'Bryan
On Tue, 2007-04-10 at 18:03 -0500, Jeremy Dunck wrote: > On 4/10/07, Todd O'Bryan <[EMAIL PROTECTED]> wrote: > ... > > The key is that he wanted to use the string name of the class, not the > > class itself. Assuming that Foo is available (i.e., is local to the code &

Re: Dumb URL question

2007-04-14 Thread Todd O'Bryan
Just a guess, but if the admin is enabled, that pattern is probably checked first. It's never getting to your pattern because it's matching the admin pattern. Todd On Sat, 2007-04-14 at 09:34 -0500, Mike Hostetler wrote: > I've been looking at this for a couple of hours and I have no idea > what

Re: django comparison

2007-04-17 Thread Todd O'Bryan
On Tue, 2007-04-17 at 21:03 -0500, M Harris wrote: > On Monday 16 April 2007 11:09, James Bennett wrote: > > A CMS like Joomla is a house, pre-built. A framework like Django is a > > toolbox and some raw materials. > Thank you for your responses folks. This is helpful. Are there > package

Re: Recommended Editor/IDE

2007-04-30 Thread Todd O'Bryan
Does anybody have a sense of how hard it would be to add code completion support for Django to Pydev? I think the problem is that there are some many instance variables and functions that are computed on the fly, rather than being declared in the classes' init functions. Todd On Mon, 2007-04-30

Re: excel import

2007-05-14 Thread Todd O'Bryan
Check out Xlrd. It will import Excel files and change them into a list of lists. http://cheeseshop.python.org/pypi/xlrd/0.5.2 Todd On Mon, 2007-05-14 at 11:25 +0200, Aidas Bendoraitis wrote: > Hello, Dmitry! > > You could save the excel sheet as comma separated values and then read > and parse

Re: My Learning Path

2007-05-19 Thread Todd O'Bryan
Check out How to Think Like a Computer Scientist (Python version). It's an intro CS text, so it may be a little basic, but it does a very good job of introducing all of the important Python concepts in a very easy-to-understand way. Dive Into Python is a terrific book, but it assumes considerable

ManyRelatedManager object is not iterable

2007-05-29 Thread Todd O'Bryan
With the latest from SVN, I'm getting an error in a template, but I can't figure out why... def obligation_list(request, org_name): org = Organization.objects.get(slug=org_name) oblig_list = org.obligation_set.all() return render_to_response('obligationList.html',

Re: ManyRelatedManager object is not iterable

2007-05-29 Thread Todd O'Bryan
On Wed, 2007-05-30 at 09:50 +0800, Russell Keith-Magee wrote: > On 5/30/07, Todd O'Bryan <[EMAIL PROTECTED]> wrote: > > > > Caught an exception while rendering: 'ManyRelatedManager' object is not > > iterable > > > > 18 {% for obligat

Re: ManyRelatedManager object is not iterable

2007-05-30 Thread Todd O'Bryan
On Tue, 2007-05-29 at 21:38 -0400, Todd O'Bryan wrote: > Template error > In > template > /home/tobryan1/workspace/dmi/src/dmi/orgs/templates/obligationList.html, > error at line 18 > > > Caught an exception while rendering: 'ManyRelatedManager'

limit_choices_to confusion

2007-05-30 Thread Todd O'Bryan
I was trying to use limit_choices_to in what I thought was an intuitive way. class Organization(models.Model): members = ManyToManyField(User) class Committee(models.Model): org = ForeignKey(Organization) chair = ForeignKey( User, limit_choices_to={ 'organizat

Add a permission to a production db

2007-10-02 Thread Todd O'Bryan
How should I add a permission to an app/model that already exists in a production db? The docs say to use syncdb, but that doesn't work (I don't think) when the db tables already exist. Also, sqlall doesn't show the SQL that's used to create the permissions. I'm just really worried that I'll acci

Re: Add a permission to a production db

2007-10-02 Thread Todd O'Bryan
On Wed, 2007-10-03 at 07:58 +0800, Russell Keith-Magee wrote: > On 10/3/07, Todd O'Bryan <[EMAIL PROTECTED]> wrote: > > > > How should I add a permission to an app/model that already exists in a > > production db? The docs say to use syncdb, but that doesn't

Re: Looping through a list in a template?

2007-10-09 Thread Todd O'Bryan
You probably want to look at this: http://www.djangoproject.com/documentation/models/pagination/ On Tue, 2007-10-09 at 21:02 -0700, Greg wrote: > Hello, > I'm trying to create a way for people to navigate through their search > results. Depending on how specific they are in their search they >

Re: elance'in django programmers

2007-10-28 Thread Todd O'Bryan
The other complication is that, in the United States, contractors have to include in their hourly rate the employer's portion of payroll taxes as well as enough money to pay for health insurance and other benefits that might be provided by virtue of citizenship in other countries, but which the co

Re: keeping SECRET_KEY secret

2007-11-01 Thread Todd O'Bryan
I actually have a production_settings.py file that only exists on my server, is not part of version control, and is only readable by the Apache user. It consists of: from settings import * DEBUG = False DATABASE_NAME = blah DATABASE_USER = blah DATABASE_PASSWORD = blah SECRET_KEY = blah where

Re: keeping SECRET_KEY secret

2007-11-01 Thread Todd O'Bryan
I then point to production_settings as my DJANGO_SETTINGS_MODULE for mod_python and the production settings overwrite the settings that I use for production. Of course, the last word should be "development," not "production." Todd --~--~-~--~~~---~--~~ You receiv

Re: spam

2007-11-07 Thread Todd O'Bryan
Does anyone know if those of us with gmail clicking the Report Spam button connects back to Google Groups, or are we just protecting ourselves? On Nov 7, 2007 4:52 PM, Jacob Kaplan-Moss <[EMAIL PROTECTED]> wrote: > > Hi folks -- > > I'm a bit late to this discussion; sorry! > > There actually is

Re: url tag difficulties

2007-11-09 Thread Todd O'Bryan
I've also been a little frustrated with the {% url %} tag. It's very easy to mess it up, and very hard to figure out what's messed up. I wonder if we couldn't provide some debugging information if DEBUG is set to true. Todd On Nov 9, 2007 10:54 PM, <[EMAIL PROTECTED]> wrote: > > I really hope t

Re: Python Question - How to show the last few elements in a list

2007-11-20 Thread Todd O'Bryan
Have you tried request.session['prod'][-7:] ? If that doesn't work, try list(request.session['prod'])[-7:] Todd On Nov 20, 2007 10:52 PM, Greg <[EMAIL PROTECTED]> wrote: > > Hello, > I have a session variable. Whenever anybody adds a product to this > session variable it gets stored like so: >

Re: validating fields with newforms - part 2

2007-11-23 Thread Todd O'Bryan
How do you clean a field that's supposed to be a date or a number, for example, if the user doesn't provide a legal date or number? If you're not allowed to throw validation errors during cleaning, you could find yourself in a situation where your later cleaning code makes assumptions that aren't

Re: Django's doctest clashes with coverage.py

2007-11-24 Thread Todd O'Bryan
On Nov 24, 2007 9:58 PM, Russell Keith-Magee <[EMAIL PROTECTED]> wrote: > If the licensing issue can't be resolved, it may be worth starting a > standalone project to handle coverage tests. We recently added the > ability for external projects to define new management commands > specifically so t

Re: Fwd: Break with Django SVN r6718

2007-12-09 Thread Todd O'Bryan
Crapola. r6718 was a patch I wrote. Without the patch you only get app-defined commands if you use manage.py. With django-admin.py, you don't get app-defined commands, even if you specify a --settings=path module. I just tried the steps you mentioned and everything works fine, both in Python 2.4

Re: Noob question: Which Linux distribution is "best" for Django?

2007-12-09 Thread Todd O'Bryan
If you decide to use Ubuntu, here's a link to how to set it up for developing Django using PyDev on Eclipse. The steps have been tested by several high school students, so they're fairly straightforward. (That doesn't mean you won't find a problem, however.) https://www.dupontmanual.org/wikis/spe

Re: Check if in query set...

2007-12-09 Thread Todd O'Bryan
s = Student.objects.get(pk=student_id) if user in s.parents.all(): // the user is legit else: // user is not s's guardian On Dec 9, 2007 6:11 PM, radioflyer <[EMAIL PROTECTED]> wrote: > > I have a m2m relationship between users (guardians) and students. > > I want to check if the curren

Re: Fwd: Break with Django SVN r6718

2007-12-10 Thread Todd O'Bryan
Hmm. What you said about not having Django installed in site-packages makes me think... What does your PYTHONPATH environment variable have in it? Do you possibly have the current directory listed before the path to Django? Because if you try to from django.conf import settings before your set

Re: no one on the IRC?

2007-12-25 Thread Todd O'Bryan
If you can ever log on and not find Magus there, I'd be surprised. I think the IRC channel has a direct link to his brain. Which is, by the way, a good thing. He (and all the other people on the channel) are an amazing resource. Todd On Dec 24, 2007 9:32 AM, Empty <[EMAIL PROTECTED]> wrote: > >

Re: How to create an "iffirst" tag?

2007-12-28 Thread Todd O'Bryan
On Dec 28, 2007 2:46 PM, Ned Batchelder <[EMAIL PROTECTED]> wrote: > > I'm making a list of objects, and only including some of them in the output: > > {% for thing in mylist %} >{% if thing.test %} > {{thing}} >{% endif %} > {% endfor %} > Is there a compelling

  1   2   3   >