generic create_object field for related 'parent' object

2008-11-09 Thread Darryl Ross
Hi All, In my application I have a list of students. Each of those students has a quite a few other models related to them via a foreign key. Eg: > class Student(models.Model): > name = models.CharField(max_length=64) > surname = models.CharField(max_length=64) > dob = models.DateFie

Re: best way to organize models that store businesses/hours?

2009-03-16 Thread Darryl Ross
Alex Gaynor wrote: > I guess technically you could just have 14 fields on the mode(open and > close for each day of the week), which is fine since days of the week > are a static number of things but that felt bulky to me(though it's > probably more preformant). The first issue that comes to mind

Re: What do you think about here lambda function to configure TEMPLATE_DIRS with relatives values ?

2009-06-30 Thread Darryl Ross
Hi Stephane, I think it is a great idea. The lambda trick means I don't have to make any changes at all to switch between my development environment and production. A real life example from a current project: - from os.path import abspath, dirname, join APP_PATH = lambda *x: abspath(join(dir

Re: python 2.5 --> 2.3, now imagefield error

2009-07-27 Thread Darryl Ross
Cody Django wrote: > ImageFields worked just fine until I moved to a new server. Now I get > error messages "Upload a valid image". I know the images are fine, > the media root and www_url are correct, so what else could this be? > Ideas are greatly appreciated! Do you have PIL installed on the

Re: Best Convension for dealing with variables needed in every view.

2009-04-05 Thread Darryl Ross
Catching up on my mailing list folders. On 30/03/2009 10:10 AM, IanR wrote: > So if I created my own I could just add it to this list and it would > do what I need. Once my context_processor is made how would I add it > to this list? Something like > settings.TEMPLATE_CONTEXT_PROCESSORS.append(

Re: how to organize favorites in template?

2009-04-19 Thread Darryl Ross
rg/snippets/1350/ {% for video in video_list %} {% if video.key in favorites.keys %} ... offer to remove {% endif %} {% endfor %} Regards Darryl -- Darryl Ross AFOYI, Information Technology Solutions e: dar...@afoyi.com p: +61 8 7127 1831 f: +61 8 8425 9607 --~--~-~--~~---

Re: ..... in templates

2009-04-19 Thread Darryl Ross
On 17/04/2009 11:26 PM, Christian Berg wrote: > Sorry if this sounds harsh, but it is useless to learn how to drive a > Truck, if you can't drive an car. Slightly tangential, but not true! My Grandfather learned to drive a truck in the army before learning to drive a car and failed his civilian

Ignoring Definite/Indefinite Articles when Sorting

2009-05-21 Thread Darryl Ross
method of doing it for MySQL: http://expressionengine.com/wiki/Sort_Entries_by_Title_Ignoring_The_A_An/ -- Darryl Ross, VK5LBJ AFOYI, Information Technology Solutions e: dar...@afoyi.com p: +61 8 7127 1831 f: +61 8 8425 9607 --~--~-~--~~~---~--~~ You received th

Re: Ignoring Definite/Indefinite Articles when Sorting

2009-05-21 Thread Darryl Ross
Forgot one thing, this is on Django 1.0.2. Regards Darryl On 22/05/2009 11:40 AM, Darryl Ross wrote: > Hi All, > > I have searched around but not really found an answer to this. For a > project I am working on the customer wants a list of publications to be > sorted alph

Re: Ignoring Definite/Indefinite Articles when Sorting

2009-05-21 Thread Darryl Ross
On 22/05/2009 12:12 PM, Sam Chuparkoff wrote: > On May 21, 10:10 pm, Darryl Ross wrote: >> I have searched around but not really found an answer to this. For a >> project I am working on the customer wants a list of publications to be >> sorted alphabetically, but

Re: Generate a daily serial/batch/lot number

2010-10-07 Thread Darryl Ross
On 06/09/10 19:09, kmpm wrote: Regarding UUIDs, one of the business requirements (which I don't control) is that the identifier that is to be used on barcodes and what not is to be in the format "YYMMDD" where is the number we are talking about. So UUID would be great and unique, as well

Re: "unexpected indent" error not allowing me to add the poll app to the admin site

2008-01-06 Thread Darryl Ross
>> I was having problems with my text editor. For some reason Python >> didn't like the way it handled tabs/spaces. I stopped using tabs and >> started using spaces, and that seemed to fix the problem. Your solution of using spaces instead of tabs to indent worked perfectly! The python inter

Generic Views: Variable Table Columns

2008-03-03 Thread Darryl Ross
Hey All, I'm using the generic views and trying to build a HTML table where both the rows and columns are generated dynamically. Simplified example follows. I am having a problem though in that I can't work out if it is possible to reference an attribute of a model using a template variable.

Re: Generic Views: Variable Table Columns

2008-03-05 Thread Darryl Ross
Just to follow up for the archives. What I was after is a getattr filter for the templates. Searching djangosnippets.org has found a couple. This one seems to do what I need: http://www.djangosnippets.org/snippets/411/ Regards Darryl Darryl Ross wrote: Hey All, I'm using the ge

Re: some database error?: not sure...

2008-04-01 Thread Darryl Ross
NOT NULL PRIMARY KEY, "code" varchar(32) NOT NULL UNIQUE, "product_line_id" integer NOT NULL, "name" varchar(128) NOT NULL, "charging_cycle" varchar(16) NOT NULL, "price" decimal NOT NULL, "active" bool NOT NU

Re: Reading an entire template into a string

2008-04-14 Thread Darryl Ross
least point me in the right direction. http://www.google.com.au/search?q=django+render_to_string -- Darryl Ross Director AFOYI, "Information Technology Solutions" p 08 7127 1831 m 0400 206 443 f 08 8425 9607 e [EMAIL PROTECTED] signature.asc Description: OpenPGP digital signature

Re: Looping....

2008-04-15 Thread Darryl Ross
Duke wrote: They are looping over a list I am looking for for (i = 0; i < 10; i++) { printf("Hello, World!); } link for looping statement I am not aware of any tag that will allow you to do that, out of the box. You have two options, the first is to create a custom template tag that d

Re: Response JSON Quoting

2008-04-17 Thread Darryl Ross
Szaijan wrote: Thanks Justin. Yes, I'm certain. And my previous install was also some variety of 0.96, though I downloaded that one manually. What was the complete SVN URL you used? You can get it with 'svn info' in the directory you checked out the Django code to. Regards Darryl signat

Re: trying to edit the geodjango wiki page

2008-04-23 Thread Darryl Ross
I believe you need to go to the 'settings' page and enter a name and email address first. Cheers -D Tyler Erickson wrote: What do I need to do to edit the following page? http://code.djangoproject.com/wiki/GeoDjango It lets me enter edit mode and preview the changes, but when I try to submit

Re: Django and CSS

2008-04-23 Thread Darryl Ross
Rodney Topor wrote: Is there something strange about using CSS with Django? When I make my templates refer to external CSS files, the appearance of the template changes, but not the way the CSS file says it should? Is there something special I need to know about this? Nothing that I am aware

Re: Django and CSS

2008-04-24 Thread Darryl Ross
or is pretty much self-container, then I will put them into the application directory. If they are specific to the website, or someone else is maintaining the HTML (I'm a programmer, not a artist!) then I'll put them in a top level templates folder. Regards Darryl -- Darryl Ross

Re: 404 on admin media files and mod_python

2008-04-25 Thread Darryl Ross
b root, it needs to point at the admin media directory in your django source. I have: Alias /admin-media/ /opt/django-trunk/django/contrib/admin/media/ SetHandler none Regards Darryl -- Darryl Ross Director AFOYI, "Information Technology Solutions" p 08 7127 1831 m

Re: Advice on RequestContext

2008-04-25 Thread Darryl Ross
Richard Atkinson wrote: Hello all! Been lurking for a while, this is my first post. Welcome! I understand that RequestContext is required in order to access {{ MEDIA_URL }} in templates. I have two questions related to this. 1. Please could somebody give an example of how to pass RequestCo

Disabling autoescaping when calling render_to_string

2008-04-26 Thread Darryl Ross
Hi All, I'm using the templating system to send emails, but the templates are being autoescaped. Now, I know I can use {% autoescape off %} in my template files, but the logic I use to build the email body is similar to: template_name = 'emails/generic.txt' if condition1: template_nam

Re: Disabling autoescaping when calling render_to_string

2008-04-26 Thread Darryl Ross
James Bennett wrote: On Sat, Apr 26, 2008 at 9:38 PM, Darryl Ross <[EMAIL PROTECTED]> wrote: So my question is, is there an argument which will disable auto-escaping? If not, would there be some merit to adding some functionality that allows this, either as an argument or perhaps to ma

Re: Disabling autoescaping when calling render_to_string

2008-04-26 Thread Darryl Ross
On Sat, Apr 26, 2008 at 9:38 PM, Darryl Ross <[EMAIL PROTECTED]> wrote: So my question is, is there an argument which will disable auto-escaping? Nevermind me, the version of code I was reading on my dev machine through was older than I thought, pre-autoescaping. I did an update and

Re: SUM on a model

2008-04-27 Thread Darryl Ross
陈亮 wrote: Hi there, I've googled a lot on how to get the sum of a integer field for all the objects of a model. There are some solutions. But none of them looks like a standard way to do so. Does django have this feature? I use: total = sum([obj.amount for obj in Model.objects.all()])

Re: Updating django forms makes me...

2008-04-27 Thread Darryl Ross
o restart your Django instance. If you wait for a few days I'll be making an announcement in that regards. Cheers Darryl -- Darryl Ross Director AFOYI, "Information Technology Solutions" p +61 8 7127 1831 f +61 8 8425 9607 e [EMAIL PROTECTED] signature.asc Description: OpenPGP digital signature

Re: Looking at objects by year, month

2008-04-28 Thread Darryl Ross
Ryan Vanasse wrote: Trying to get the outer for loop working is something that I don't really understand. I think that what I have now isn't going to work because I'm using a dictionary reference on what was transmuted into the Context, so that "eventsByMonth" doesn't exist... I've been trying

Re: Login issue

2008-04-28 Thread Darryl Ross
Hi Bret, Can't see that anyone else has responded to this. Bret W wrote: There are many times when I can enter a username and password, click the "login" button, and get the username/password don't match error. The error page (/accounts/login, using example template from docs) automatically fi

Re: Processing saves()

2008-04-28 Thread Darryl Ross
Lee Hinde wrote: After the line item is saved, I want to call the Work Order to have it update a Total Due column. Assuming I have the code in the Work Order model to get all the related line items and sum the extended price, what I would do is call the Work Order save() method from the Line Item

Re: Template Tags Inside 'ifequals'

2008-04-28 Thread Darryl Ross
Szaijan wrote: Is there a way to access the URL values assigned to the view names within a view? Perhaps something less inelegant than importing urls.py and searching for the view name in the tuple? Otherwise I've traded hardcoding URLs into one template for hard coding them into 5+ views. Do

Re: Template Tags Inside 'ifequals'

2008-04-28 Thread Darryl Ross
Darryl Ross wrote: Szaijan wrote: Is there a way to access the URL values assigned to the view names within a view? Perhaps something less inelegant than importing urls.py and searching for the view name in the tuple? Otherwise I've traded hardcoding URLs into one template for hard c

Re: Looking at objects by year, month

2008-05-02 Thread Darryl Ross
roperty def month_is_even(self): return self.start_DateTime.month % 2 and False or True That code is of course making the assumption that start_DateTime can never be Null, or you're likely to end up with an exception: "NullType has no property month" Cheers Darryl --

Re: EmailMessage and Escaping issue

2008-05-07 Thread Darryl Ross
Julien wrote: I'm using EmailMessage to send a newsletter. It works fine except that some characters are escaped in the plain text version. For exemple, "é" becomes "é". If you are using the django template engine to build the body of your emails, you can either use the 'safe' template variabl

Re: Chaining Filters for many-to-many

2007-10-30 Thread Darryl Ross
Kevin wrote: > models.TestLine.objects.filter(dimm__size=1024).filter(dimm__size=2048) > > This returns an empty set, but I know there is a test with multiple > dimm objects and meets this criteria. Is there a limitation that I'm > missing here? Is there an alternative method to accomplish the in

Limiting Foreign Key choices to members of a certain group using generic views

2007-11-02 Thread Darryl Ross
Hey All, I'm after a way of limiting what choices are populated into a drop-down box from a foreign key field when I'm using the generic create/update views: What I am trying to achieve is to be able to limit the list of domains that a reseller can apply to their customer objects to domains that

Splitting models.py into a package

2007-11-07 Thread Darryl Ross
Note: Resending as this hasn't shown up on the list after 3 hours. Appologies if it does decide to make an appearance. Hey All, I have an app that has quite a few models in it, so I am trying to split it out into a package, but when I do the models do not show up in the admin interface and

Re: Splitting models.py into a package

2007-11-07 Thread Darryl Ross
Hi Daniel, > class Foo(models.Model) > some_field = models.CharField(max_length=200) > class Meta: > app_label = 'app' Thanks for that, as soon as I added the app_label to the Meta class it started working. Regards -D signature.asc Description: OpenPGP digital signature

Splitting models.py into a package

2007-11-07 Thread Darryl Ross
Hey All, I have an app that has quite a few models in it, so I am trying to split it out into a package, but when I do the models do not show up in the admin interface and running 'manage.py sqlall app' does not show any SQL statements for creating the tables. Is there a trick to doing this? The

Re: Unsubscribing from this group... impossible?

2007-11-10 Thread Darryl Ross
Melech Ric wrote: > Actually, I've tried that and the web i/f doesn't think I'm subscribed. > It's rather odd. I subscribed through the form on the django site and > didn't realize it was a google group until the mail started showing up. > I'd have rather done it through google's web i/f had I know

Re: User Authentication and Models

2007-11-11 Thread Darryl Ross
Patrick Ohearn wrote: > I have tried adding the following lines to by models.py. > > author = models.ForeignKey(User) > author = models.ForeignKey(django.contrib.auth.models.User) > > Both to no avail, thank you for your help so far :) Perhaps a more complete example might help you: {{{

Re: Using a signal to update a counter cache??

2007-11-30 Thread Darryl Ross
Tane Piper wrote: > As you can see in the Branch model, there is a field called num_leafs > - I've been reading the signals documentation and had a look on the > web, but I'm still having difficulty getting my head around it. What > I want to do is when a leaf is saved, on the post_save signal I w

Re: Do away with django's support for python 2.3?

2007-12-01 Thread Darryl Ross
AmanKow wrote: > I am curious as to whether the django community cannot comfortably do > away with support for python 2.3 in the effort towards django 1.0. RHEL4 (and hence CentOS 4) still uses 2.3.4. I do not know what the other commercially supported distros are running, but I would imagine the

Re: templating javascript code

2007-12-02 Thread Darryl Ross
msoulier wrote: > I want to split this javascript out. Has anyone tried templating > javascript like any other file? I'm going to try it out, but I thought > I'd ask if anyone knew of any problems, or any better way to do this. I've done this is CSS files before, so it should work just fine. Just

Re: newbie questions

2007-12-02 Thread Darryl Ross
dave's not here wrote: > I'm trying to help out a friend in a bind whose programmer is no > longer reachable, and have a few newbie questions. I've just started > working with both python and django, and am working my way thru the > python and django tutorials; my background is with perl and php.

Re: newbie questions

2007-12-03 Thread Darryl Ross
Kenneth Gonsalves wrote: > > On 03-Dec-07, at 10:38 AM, dave's not here wrote: >> Thanks for the quick reply. The problem is I don't currently have >> shell access to the server, only ftp. Is there anything I can put into >> one of the .py or template files? Create a view that imports django and

Re: Order By Calculated Value??

2007-12-05 Thread Darryl Ross
Hi Tane, [untested with Many2Many, but should work, it works for ForeignKeys] In your Entry save() method call the save method of each of your related categories after you do your super().save() {{{ class Entry(models.Model): ... def save(self): if not self.slug: self

Combating submission form Spam

2007-12-05 Thread Darryl Ross
Hey All, One of the websites I run has started getting spam via the contact form. What is the recommended way of dealing with this? Do I need to go the route of using something like django-captcha? Thanks for any insight. Regards Darryl signature.asc Description: OpenPGP digital signature

Re: Combating submission form Spam

2007-12-05 Thread Darryl Ross
John Lenton wrote: > recaptcha: > http://recaptcha.net/ Looks like an interesting project, I will check it out. Thanks. Regards Darryl signature.asc Description: OpenPGP digital signature