Re: Setting tzinfo for DateTimeFields with Postgresql - workaround

2009-09-28 Thread George Song
Sounds about right to me. Hopefully I'll have more time after this month to pick this up again. On Aug 16, 6:24 pm, Ramiro Morales <cra...@gmail.com> wrote: > Hi George, > > On Thu, May 21, 2009 at 7:56 PM, George Song<geo...@damacy.net> wrote: > > > Hi Glenn, >

Re: use of HttpResponseForbidden(), etc.

2009-05-23 Thread George Song
On 5/23/2009 9:07 AM, ken keller wrote: > When my view returns: > > return HttpResponseForbidden() > > the browser doesn't show the non-200 status. How are you determining that the browser is not receiving a 403 status? -- George --~--~-~--~~~---~--~~ You

Re: Plugin technology

2009-05-23 Thread George Song
On 5/23/2009 8:53 AM, Jani Tiainen wrote: > Kai Diefenbach kirjoitti: >> Hi Jani, >> >> On 23 Mai, 14:13, Jani Tiainen wrote: >>> I'm designing application (site) that is supposed to rely heavily on >>> pluings. >>> >>> i didn't found much of references how I can create plugin

Re: Plugin technology

2009-05-23 Thread George Song
On 5/23/2009 5:13 AM, Jani Tiainen wrote: > I'm designing application (site) that is supposed to rely heavily on > pluings. > > i didn't found much of references how I can create plugin that can > provide something useful for my main template. something like: > > myplugin.py: > >

Re: how to load data?

2009-05-22 Thread George Song
On 5/22/2009 5:07 PM, Herta wrote: > I want to load data to database (sqlite3 ) from file. I have already > connect django and my database, and build the tables but how can i > load data from file? What kind of files are these? If they are existing legacy data files, you'll have to write some

Re: Making queries on manytomany tables

2009-05-22 Thread George Song
On 5/22/2009 5:31 PM, Patrick wrote: > What is the best way to make queries on a manytomany table? > > Given the models below, how can I get a list of all the songs a > particular artist has? > > class Artist(models.Model): > name = models.CharField(max_length=128) > >def

Re: Setting tzinfo for DateTimeFields with Postgresql - workaround

2009-05-21 Thread George Song
On 5/16/2009 10:28 PM, Glenn Maynard wrote: > This is just a quick hack for anyone else bit by this: tzinfo is never > set when reading DateTimeFields out of the database, at least with > Postgresql. > > Now, I have no idea why anyone would want to set TIME_ZONE to anything > but UTC (and the

Re: Question: What's the best way to denormalize M2M data?

2009-05-19 Thread George Song
On 5/19/2009 9:47 AM, Ben Welsh wrote: > On Tue, May 19, 2009 at 12:18 AM, George Song <geo...@damacy.net > <mailto:geo...@damacy.net>> wrote: > > > You can always explicitly define the m2m model, then you can override > the save() on that model if you

Re: Import Error: couldn't locate module Http.Isapi

2009-05-19 Thread George Song
On 5/18/2009 6:53 AM, BuckRogers wrote: > Hi, > > I am using IIS6/Python2.5/mssql 2000 on windows server 2003 > > I followed the instructions available here: > http://code.djangoproject.com/wiki/DjangoOnWindowsWithIISAndSQLServer > > PyISAPIe doesn't seem to work, I am getting Import Error:

Re: ModelForm question

2009-05-19 Thread George Song
On 5/18/2009 12:55 PM, Rusty Greer wrote: > > i have the following: > > a model: > class MyClass(models.Model): > otherClass = models.ForeignKey('otherClass') > someData = models.CharField(max_length=20) > > > class MyClassForm(forms.ModelForm): > > class Meta: > model =

Re: Form Wizard and Saving to Database

2009-05-19 Thread George Song
On 5/18/2009 4:01 PM, geraldcor wrote: > Hello all, > > I am working on my second Django app and it involves a very long form. > I successfully used modelForms in my last app to successfully save > form data to a database. > > With this long form, I have split it up into smaller forms

Re: Question: What's the best way to denormalize M2M data?

2009-05-19 Thread George Song
On 5/18/2009 8:51 PM, palewire wrote: > I've stumbled my way into methods for automatically denormalizing > ForeignKey data -- and now see that better approaches have been > packaged up the very cool django-denorm (http://code.google.com/p/ > django-denorm/) -- which is great. > > But I'm

Re: abstract classes in models

2009-05-15 Thread George Song
On 5/15/2009 10:08 AM, Rusty Greer wrote: > > > On Fri, May 15, 2009 at 9:57 AM, George Song <geo...@damacy.net > <mailto:geo...@damacy.net>> wrote: > > > On 5/15/2009 8:18 AM, Rusty Greer wrote: > > > > > > I have

Re: abstract classes in models

2009-05-15 Thread George Song
On 5/15/2009 8:18 AM, Rusty Greer wrote: > > > I have something like this: > > class Class1(models.Model): > // lots of fields here > > class AbstractThing(models.Model): > // lots of fields here > class1field = model.ForeignKey(Class1) > class Meta: > abstract = True

Re: ForeignKeys to MTI models break admin (as of 10756)

2009-05-15 Thread George Song
On 5/14/2009 11:40 PM, Russell Keith-Magee wrote: > On Fri, May 15, 2009 at 2:21 PM, Michael Strickland > wrote: >> Hi all, >> >> I've recently encountered a problem that arose with revision 10756. >> Say you have the following models: >> >> class Person(models.Model): >>

Re: Trouble starting up runserver

2009-05-12 Thread George Song
On 5/12/2009 2:01 PM, Chris DPS wrote: > I am new to Django. > > When I try to execute: python manage.py runserver, I get the following > error > > Error: [Errno 10104] getaddrinfo failed > > What is going on and what should I do? > > I am running Django Version 1.0.2-final and Python 2.6 >

Re: How do you handle apostrophe and spaces in dynamic url?

2009-05-12 Thread George Song
On 5/12/2009 1:10 PM, Thierry wrote: > I have a table with the following names: > > id name > 1 Foo > 2 Foo goo > 3 Foo's goo > > I want to use the name to construct my url. I don't have a problem > constructing Foo: > > localhost/foo > > But how am I supposed to

Re: how can I modify automatic ordering of fields in a ModelForm?

2009-05-12 Thread George Song
On 5/12/2009 12:28 PM, Luke Graybill wrote: > Here is how I've implemented field ordering for 1.0.2 The snippet doesn't appear to be available anymore. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users"

Re: how can I modify automatic ordering of fields in a ModelForm?

2009-05-12 Thread George Song
On 5/12/2009 12:12 PM, Alex Gaynor wrote: > You can control the order of fields on a modelform by settings the > ordering in the fields option in the inner Meta class. That is if you > set fields = ['b', 'a', 'c'] that's the same order they will apear in. Duh. There you go, problem solved:

Re: how can I modify automatic ordering of fields in a ModelForm?

2009-05-12 Thread George Song
On 5/12/2009 11:32 AM, Luke Graybill wrote: > I didn't mean to imply a feature suggestion, I meant to ask if this is > possible already. If not, then is there some way to manipulate the form > __init__ (through _meta.fields perhaps?) to accomplish an approximation > of what I want? > > I'm

Re: how can I modify automatic ordering of fields in a ModelForm?

2009-05-12 Thread George Song
On 5/12/2009 11:22 AM, Luke Graybill wrote: > Is there a good way to dynamically reorder these fields on the fly? > Preferably, the code should be contained within the Mixin class. In > my situation, the mixin fields would be better if placed after all > the other fields on a model, but in

Re: flatpage content not appearing

2009-05-12 Thread George Song
On 5/12/2009 10:54 AM, Jesse wrote: > Now I get all kinds of 404 errors. I guess I'm missing something in > my understanding of flatpages. I was going to place all my html pages > into flatpages, including the home page. How does all that work > without using URLs and views? It's answered in

Re: get_or_create not atomic?

2009-05-12 Thread George Song
On 5/12/2009 10:47 AM, Phil Mocek wrote: > It seems risky to try to handle at the > application level these things that a DBMS is specifically > designed to do. Well, exactly. If the correct constraints are put in place, then your DB/adaptor would raise the proper error. So if a row is

Re: Help a noob with a stupid question - forms

2009-05-12 Thread George Song
On 5/12/2009 7:05 AM, zachp wrote: > Yes, but the calendar widget isn't what I want. My user only really > needs to pick a month (and maybe a year) but not a day. I could resort > to using that field type, but I wanted to see if I could overcome this > problem since, at least in my opinion, the

Re: session through redirects

2009-05-12 Thread George Song
On 5/12/2009 5:45 AM, Iqbal Abdullah wrote: > I'm confused on how to get data in request.session if a certain view > redirects the user using HttpResponseRedirect() > > A sample code: > > def view_start(request): > try: > Member(id) > except Exception, e: >

Re: modular django site: projects vs. apps

2009-05-12 Thread George Song
On 5/12/2009 3:27 AM, mabuse wrote: > I am developing a django site and my aim is to obtain a site with a > core application that would be the site basis and above it addons > that would upgrade the standard application ( like firefox and its > extensions). > > My question is, how can I achieve

Re: two models, 1 table

2009-05-11 Thread George Song
On 5/11/2009 8:55 PM, rpupkin77 wrote: > Hi, can I use the same table in two different models and surface > different data in each, model, particularly in the admin panel? Sounds like a job for proxy models[1], each with its own default manager.

Re: How to create a newforms label unattached to an input field?

2009-05-11 Thread George Song
On 5/11/2009 12:29 PM, Nash-t wrote: > I apologize if this is a dumb newbie question... > I am trying to create a newform label that doesn't have an associated > input field. This label is used as a title for a set of input fields. > I don't want to use django templates because of the way the

Re: After a form submit, getting user info into an attribute while still using generic views?

2009-05-11 Thread George Song
On 5/11/2009 4:04 AM, Lior wrote: > Hello, > I'm using generic views to manage a model. In that model, when I > create an instance (and not when I update it), I need to set one of > its attribute (owner) to the currently logged in user value. I'd like > to continue using generic views, so can I

Re: Accessing value of a Form.Field in templates

2009-05-10 Thread George Song
On 5/10/2009 5:32 PM, Martin wrote: > > On 11 Mai, 02:07, George Song <geo...@damacy.net> wrote: >> The ticket doesn't appear to be what you're asking for. I think the >> easiest way is for you to insert an extra context variable in your view, >> since `GET` a

Re: Accessing value of a Form.Field in templates

2009-05-10 Thread George Song
On 5/10/2009 4:27 PM, Martin wrote: > Hi, > > I'm trying to check in a template if the form on this page was sent or > not (in other words if the page was accessed by POST or GET). Is there > a build-in way to do something like that down on the template. Or do I > have to add a extra 'flag' for

Re: Field value from queryset as extra_context

2009-05-10 Thread George Song
On 5/10/2009 8:03 AM, Jamie Pittock wrote: > Please excuse the subject if it makes no sense. > > Simplified, I have two models Pub and Town. Pub has a ForeignKey > field called 'town'. I'm using the generic object_list view to > display all pubs in a particular town (based on a town slug in

Re: User Authentication Woes

2009-05-10 Thread George Song
On 5/10/2009 5:38 AM, Alfonso wrote: > Hi, > > App I'm currently working on can be accessed by either authorised > admin users or authenticated customers (one customer might have a > number of users on their account). A non-admin user can login and > view restricted sections of the site to

Re: How to disable deletion af a model instance

2009-05-09 Thread George Song
On 5/9/2009 12:34 PM, Margie wrote: > I've had my share of confusion over delete. Here's a thread that I > had with Malcolm recently: > > http://groups.google.com/group/django-users/browse_thread/thread/582f21486c1073eb/7f5743953047d9fa?lnk=raot=1 > > However, I guess I'm still quite confused.

Re: timeuntil filter

2009-05-09 Thread George Song
On 5/9/2009 11:28 AM, adrian wrote: > > This filter is returning an empty string for a valid date (or datetime > with 0,0,0 added) in > Django 1.0.2. > > The documentation for this says: > >> Comparing offset-naive and offset-aware datetimes will return an empty >> string. > > but it doesn't

Re: Print question

2009-05-09 Thread George Song
Does `pprint.pprint(obj.__dict__)` not do what you want? On 5/9/2009 8:41 AM, phoebebright wrote: > Masklinn, > > Thanks. I see what you mean about being bored! But that's a big step > forward for me. > > As a PHP convert to Django/Python, I'm looking for the equivalent of > print_r > > On

Re: How to disable deletion af a model instance

2009-05-09 Thread George Song
On 5/9/2009 7:14 AM, Rune Bromer wrote: > Hi, > > I run a small project handling payments from users. Each user has the > possibility to delete their account and if they do I have to keep > their payment data. Also, I would like to disable admins from deleting > the data as there are NEVER a

Re: TypeError: unsupported operand type(s) for +: 'NoneType' and 'int'

2009-05-08 Thread George Song
On 5/8/2009 5:58 PM, Lee Hinde wrote: > On Fri, May 8, 2009 at 5:12 PM, Lee Hinde <leehi...@gmail.com> wrote: >> On Fri, May 8, 2009 at 4:48 PM, George Song <geo...@damacy.net> wrote: >>> On 5/8/2009 4:32 PM, Lee Hinde wrote: >>>> Hi; >>>> >

Re: using id as a model field name ?

2009-05-08 Thread George Song
On 5/8/2009 4:31 PM, paul wisehart wrote: > I didn't realize that id was a python builtin function. > > I have a large pre-existing database that I wrote a bunch of models > for. > > I used 'id' as the primary key field for all of them. > > """ > class SalesQuoteItemDetail(models.Model): >

Re: TypeError: unsupported operand type(s) for +: 'NoneType' and 'int'

2009-05-08 Thread George Song
On 5/8/2009 4:32 PM, Lee Hinde wrote: > Hi; > > I get the error below at a point I'm trying to add 1 to an int field. > I'm understanding the error that django doesn't know what the type is > for sn. > > > Model: > > class Sequence_Number(models.Model): > Sequence_Name =

Re: Moving from perl/cgi to Django/Python

2009-05-08 Thread George Song
On 5/8/2009 6:55 AM, consiglieri wrote: > I have a running perl/cgi app in conjunction with mysql which works > fine. > > For various reasons i want to move to either django or RoR. I've > pretty much decided to go with Django, however i'm wondering about one > thing. > > Ideally i would like

Re: QuerySet.values() for single object?

2009-05-08 Thread George Song
On 5/7/2009 9:23 PM, Shadow wrote: > If i get a model object with Model.objects.get() > > Is their a way to turn that into a dictionary? Why not just filter for it and use values()? -- George --~--~-~--~~~---~--~~ You received this message because you are

Re: limiting choices for foreign key choices in the admin view

2009-05-07 Thread George Song
On 5/7/2009 9:19 PM, Margie wrote: > Thanks much George, that was a big help. I have some "proof of > concept code below" that simply limits choices to the first four > users, and I have verified that that works. > > class TaskAdmin(admin.ModelAdmin): > > def formfield_for_dbfield(self,

Re: Annotations

2009-05-07 Thread George Song
On 5/7/2009 4:28 PM, Andy Lei wrote: > I have 3 models. Something like this: > > Writer: > content = ManyToMany(Content) > Content > tags = ManyToMany(Tag) > Tag > > Now suppose I have a Tag, call it "tag1". The idea of the query is > that I want the Writers that have the most

Re: limiting choices for foreign key choices in the admin view

2009-05-07 Thread George Song
On 5/7/2009 6:29 PM, Margie wrote: > I know this question has been pondered in a bunch of posts, and I'm > sorry to repeat it, but I just can't figure out what is the right > direction to take. > > Let's say I have a model for a Task: > > class Task(models.Model): > owner =

Re: TIME_ZONE problem

2009-05-07 Thread George Song
On 5/7/2009 5:00 PM, Graham Dumpleton wrote: > > > On May 7, 2:41 am, George Song <geo...@damacy.net> wrote: >> On 5/6/2009 4:02 AM, Graham Dumpleton wrote: >> >> >> >> >> >>> On May 6, 4:38 am, George Song <geo...@damacy.ne

Re: Problem with overriding save() method

2009-05-07 Thread George Song
On 5/7/2009 8:05 AM, Lee Hinde wrote: > On Wed, May 6, 2009 at 11:37 PM, George Song <geo...@damacy.net> wrote: >> On 5/6/2009 11:18 PM, Lee Hinde wrote: >>> On Wed, May 6, 2009 at 11:15 PM, Lee Hinde <leehi...@gmail.com> wrote: >>>> On Wed, May 6, 2009 a

Re: Wrapping object_detail generic view in another view

2009-05-07 Thread George Song
On 5/7/2009 1:01 PM, Jamie Pittock wrote: > Basically, am I doing things right, and if so which is the best > solution from the above? Yup, you are doing things correctly as far as I can tell. As for creating a custom method or not, it's up to you, it's just a convenience wrapper, after all. I

Re: Need help optimizing a view, too many queries

2009-05-07 Thread George Song
On 5/7/2009 11:16 AM, Eric Chamberlain wrote: > > On May 7, 2009, at 10:36 AM, George Song wrote: > >> On 5/7/2009 8:56 AM, Eric Chamberlain wrote: >>> Our view is taking too long to render, can anyone offer suggestions >>> to >>> improve

Re: Aggregated Expression.

2009-05-07 Thread George Song
On 5/7/2009 10:42 AM, overgroove wrote: > I have the following models: > > Customer > Order > Lineitem > > Customers have orders and orders have lineitems. In lineitems there's > a product price and a product quantity. I would like to be able to, > using django querysets and whatever magic I

Re: Need help optimizing a view, too many queries

2009-05-07 Thread George Song
On 5/7/2009 8:56 AM, Eric Chamberlain wrote: > Our view is taking too long to render, can anyone offer suggestions to > improve its speed? > > There are 5830 profiles. > > /Total query count:/ 23809 > /Total duplicate query count:/ 493 > /Total SQL execution time:/ 66.003 > /Total Request

Re: ManyToMany relationships in an object creation view

2009-05-07 Thread George Song
On 5/3/2009 12:59 AM, notcourage wrote: > I'm interested in hearing how you cope w/ the problem of specifying > ManyToMany relationships in an object creation view. Consider two > models M1 & M2 and a creation view/form for M1. A technique I'm using > is to specify M2 values as an unbound field

Re: Ajax and non-ajax forms.

2009-05-07 Thread George Song
On 5/7/2009 1:43 AM, Chris Dew wrote: > Do other developers consider it vital to support non-javascript > browsers for accessibility reasons? Or are people largely using ajax > regardless of accessibility, to make their apps look shiny? It depends on who the app is for. If it's in a corporate

Re: Problem with overriding save() method

2009-05-07 Thread George Song
On 5/6/2009 11:18 PM, Lee Hinde wrote: > On Wed, May 6, 2009 at 11:15 PM, Lee Hinde <leehi...@gmail.com> wrote: >> On Wed, May 6, 2009 at 10:54 PM, George Song <geo...@damacy.net> wrote: >>> On 5/6/2009 10:34 PM, Lee Hinde wrote: >>>> On Wed,

Re: Problem with overriding save() method

2009-05-06 Thread George Song
On 5/6/2009 10:34 PM, Lee Hinde wrote: > On Wed, May 6, 2009 at 10:22 PM, George Song <geo...@damacy.net> wrote: >> On 5/6/2009 9:57 PM, Lee Hinde wrote: >>> I have this as part of the model for a class called "Class" >>> >>> >>&

Re: Problem with overriding save() method

2009-05-06 Thread George Song
On 5/6/2009 9:57 PM, Lee Hinde wrote: > I have this as part of the model for a class called "Class" > > > def save(self, force_insert=False, force_update=False): > start = defaultfilters.slugify(self.Name) > count = Class.objects.filter(Slug__equal=start).count() >

Re: running filters on db objects in template?

2009-05-06 Thread George Song
On 5/6/2009 5:32 PM, snorkel wrote: > I am passing a model to a template that also has foreign keys to other > models, so in my template I can do things like > {% for a in a_list %} >{% for b in a.b_model.all %} > this is b.name b.value b.date >{% endfor %} > {% endfor %} > > Is

Re: Run context processor conditionally?

2009-05-06 Thread George Song
rom every view for > which one wants to use the context processor anyway, huh? > > I always feel like I'm repeating myself when passing global context to > every single template. > > On May 6, 5:13 pm, George Song <geo...@damacy.net> wrote: >> On 5/6/2009 1:37 PM, rin

Re: Run context processor conditionally?

2009-05-06 Thread George Song
On 5/6/2009 1:37 PM, ringemup wrote: > I've got some context that every view in one of my apps needs to pass > to its templates... but that I don't want to have to run for pages > that don't use that app, since it executes a lot of queries. Is there > a way to execute the context processor only

Re: aggregate formatting

2009-05-06 Thread George Song
On 5/6/2009 10:27 AM, mamco wrote: > I have two models "Deposit" and "Cheque". I'm trying to show total > the amount of cheques in the admin area using the method name in the > list_display. It seems to work (although I think the documentation > suggests it may not because it requires the

Re: Django and a basic SQL join

2009-05-06 Thread George Song
In your case e is a QuerySet, with multiple FlattenedCategory objects. So the proper code would be to loop through them: {{{ for fc in e: fc.category_set }}} On 5/6/2009 10:17 AM, jrs_66 wrote: > No... 'QuerySet' object has no > attribute 'category_set' > > George, > > I have read the

Re: Django and a basic SQL join

2009-05-06 Thread George Song
On 5/6/2009 9:48 AM, jrs_66 wrote: > I have 2 models... > > class Category(models.Model): > name = models.CharField(max_length=255) > parent = models.ForeignKey('self', null=True) > has_children = models.BooleanField(default=False) > language = models.ForeignKey(Language,

Re: Help with some models inheritance and the use of default

2009-05-06 Thread George Song
On 5/6/2009 6:56 AM, Felix wrote: > I have the next models: > > class Place(models.Model): > currency = models.CharField(_('currency'), max_length=128, > blank=True, null=True) > language = models.CharField(_('official language'), > max_length=128, blank=True, null=True) > class

Re: TIME_ZONE problem

2009-05-06 Thread George Song
On 5/6/2009 4:02 AM, Graham Dumpleton wrote: > > > On May 6, 4:38 am, George Song <geo...@damacy.net> wrote: >> On 5/5/2009 6:48 AM, Michel Thadeu Sabchuk wrote: >> >> >> >>> Hi guys, >>> I'm having a weird problem with TIME_ZONE setti

Re: Getting to the 'latest' item in a template list

2009-05-06 Thread George Song
On 5/5/2009 5:13 AM, Alfonso wrote: > I'm using the following to pull all cost prices that match a > particular product by the company that supplied the product: > > View: > > cost_prices = ProductCostPrice.objects.filter > (product_id__product_id=product_id) > > Template: > ... > {% regroup

Re: Django custom ManyToManyField widget

2009-05-06 Thread George Song
On 5/6/2009 6:07 AM, atik wrote: > When i create a ModelForm from a Model with a ManyToManyField in it, > the default widget creates a select drop down with all the foreign key > objects in it. I want to replace the widget with a textarea with a > comma separated list of names.How can i do this?

Re: Can not get Django admin page

2009-05-05 Thread George Song
On 5/5/2009 8:57 AM, David wrote: > Hello, > > I am following those steps in django tutorial 2, however I can not > get "django administration: Username and Password" page. I still get > the "Welcome" page. > > I did these steps twice but I got the same result. > > 1. Add

Re: restrict choice of recursive many to many relation

2009-05-05 Thread George Song
On 5/5/2009 12:29 PM, Bastien wrote: > This is quite new to me, I have done a recursive (self) many to many > relation between blog entries so they can be linked together if the > user thinks they are semantically related. It works but I would like > to restrict the choices I can see in the admin

Re: restrict choice of recursive many to many relation

2009-05-05 Thread George Song
On 5/5/2009 12:29 PM, Bastien wrote: > This is quite new to me, I have done a recursive (self) many to many > relation between blog entries so they can be linked together if the > user thinks they are semantically related. It works but I would like > to restrict the choices I can see in the admin

Re: TIME_ZONE problem

2009-05-05 Thread George Song
On 5/5/2009 6:48 AM, Michel Thadeu Sabchuk wrote: > Hi guys, > > I'm having a weird problem with TIME_ZONE settings. Some view list > objects based on the time, future time objects are not shown. > > The problem is that sometimes all objects that need to be shown appear > normally, sometimes

Re: "Lookups that span relationships" + objects.exclude()

2009-05-05 Thread George Song
On 5/5/2009 12:47 AM, bweiss wrote: > So to enter a Qualification obtained, users choose a name from the > data in the Employee table, and a Qualification Type from the data in > that table, and then enter the remaining details (eg. date > obtained, expiry date). Also the Qualification table

Re: Create a web service for an existing stand alone python script

2009-05-05 Thread George Song
On 5/5/2009 4:39 AM, pallavi wrote: > Dear all, > thans for your input. > I read doumentation from different resources and still confused to > solve my problem. any help would be appreciated. > > My main python program is science.py > it have several modules.in it (each definition reads some

Re: "Lookups that span relationships" + objects.exclude()

2009-05-05 Thread George Song
On 5/5/2009 12:47 AM, bweiss wrote: > Thanks Alex, that's really helpful and I'm certainly closer now! > However, after a fair bit of experimenting with that exclude() method, > I still can't quite get it to do what I need. > > I'm trying to get a list of all employees who do not have a >

Re: ManyToMany with a "through" attribute in the admin profile

2009-05-05 Thread George Song
On 5/4/2009 6:36 PM, nbv4 wrote: > > > On May 4, 12:03 am, George Song <geo...@damacy.net> wrote: >> On 5/3/2009 8:17 PM, nbv4 wrote: >> >> >> >>> On May 3, 3:51 pm, Ramiro Morales <cra...@gmail.com> wrote: >>>> On Sun, May 3,

Re: form elements css changes on errors

2009-05-05 Thread George Song
On 5/4/2009 10:23 AM, joeygartin wrote: > I would like to add a css class to form elements if there is an error > in the form. Not sure the BEST/EASIEST way to do this. I would only > want the attribute added if there was an error and I would like to do > this in the cleanest way possible.

Re: data too long in a CharField column

2009-05-04 Thread George Song
On 5/4/2009 8:46 AM, MS wrote: > I have a problem with django+postgresql: > I have a model with a CharField(max_length=255) field, and I'm > assigning some much longer value to this field, like: > > m = MyModel() > m.myfield = 'very long text - say 400 chars' > m.save() > > In save() I'm

Re: Anyone else having issues with filter_horizontal in trunk?

2009-05-04 Thread George Song
On 5/4/2009 8:24 AM, Brandon Taylor wrote: > filter_vertical also appears to be suffering the same problem. > > On May 4, 10:23 am, Brandon Taylor wrote: >> Hi everyone, >> >> When I specify filter_horizontal for any ManyToMany field on a model >> using Django trunk,

Re: How to handle view/url situation (Newbie)

2009-05-03 Thread George Song
On 5/3/2009 9:54 PM, scott212 wrote: > I'm reading through the djangobook and trying to build a small app as > I go. The app is just a list that I can add to and delete entries > from. Deleting is easy, but I'm not sure how the url/view portion > should be handled. > >

Re: Os.path in window and linux help?

2009-05-03 Thread George Song
On 5/3/2009 9:36 PM, phan sarak wrote: > this is the def in my view.py > > # > return ouputting_pdf('reports/employee_report_pdf.html',{ > 'pagesize':'A4', > 'curr_employee':get_employee, >

Re: ManyToMany with a "through" attribute in the admin profile

2009-05-03 Thread George Song
On 5/3/2009 8:17 PM, nbv4 wrote: > On May 3, 3:51 pm, Ramiro Morales wrote: >> On Sun, May 3, 2009 at 4:26 PM, nbv4 wrote: >> >>> Everything is fine and dandy, except for when I want to use the admin >>> interface to create a new route. All I see is a

Re: problem rendering html images in browser

2009-05-03 Thread George Song
On 5/3/2009 7:22 PM, Mac wrote: > I've had trouble rendering images in my browser. I just get a broken > link. Any thoughts on how to fix this? I'm working with the > development server, and I've check my code carefully to insure the src=path/> to the image file is correct. If I open the html

Re: Altering database object

2009-05-02 Thread George Song
On 5/2/2009 6:24 PM, Vedlen wrote: > I've got multiple tuples, and I need all the fields. > I just need to pass all the "moment" fields from the tuples, into my > function. > > Here is what my template looks like : > > > {{ for s in Score }} > {{ s.moment }}{{ s.someOtherField }} > {{ endfor

Re: print_r() in Django & SQL debug output

2009-05-02 Thread George Song
On 5/2/2009 4:53 PM, Okto Silaban wrote: > Ok, I know this is not a PHP mailing list.. I just want to make the > question simpler. > > I'm coming from CakePHP background. > > 1. What Django template tags can I use to replace print_r() / var_dump() > in PHP? > 2. How can I display SQL debug

Re: Create a web service for an existing stand alone python script

2009-05-02 Thread George Song
On 5/2/2009 10:01 AM, pallavi wrote: > Dear Mr.George, > > Thank a lot for your help. > But, in the python program "science.py" there are several functions > that do some calculations by reading the values in the two input > files. > > your code: >> from science import my_function >

Re: Debug middleware

2009-05-02 Thread George Song
On 5/2/2009 9:53 AM, Malcolm Tredinnick wrote: > On Sat, 2009-05-02 at 04:11 -0700, Kless wrote: >> How to debug a middleware? I would print any variables for a >> middleware that I'm building >> >> Is there any way to make it? > > In any sensible web server setup, printing to sys.stderr will

Re: getting no such table error

2009-05-02 Thread George Song
On 5/2/2009 8:32 AM, tekion wrote: > No, I ended up removing the db and recreating it via manage.py > syncdb. it works after this. > > Next time I will log into SQL lite and check it out. > > I am curious why running "manage.py syncdb" didn't work until I blow > away the db and re-run it. Is

Re: Displaying rows as columns

2009-05-02 Thread George Song
On 5/2/2009 7:40 AM, George Song wrote: > Pass `entries` and `schedule` as context vars to your template, and > you can iterate through your schedule using ordered list of entries. There's also `django.utils.datastructures.SortedDict` so you can bypass the `entries` business and save yo

Re: Accessing related object data in template

2009-05-02 Thread George Song
On 5/2/2009 6:07 AM, Paddy Joy wrote: > I have a model "Car" with a related model "Car_Attribute" where I > store instance specific details. > > > class Car(models.Model): > name = models.CharField(max_length=50) > > class Car_Attribute(models.Model): > car = models.ForeignKey(Car) >

Re: getting no such table error

2009-05-02 Thread George Song
On 5/2/2009 6:02 AM, tekion wrote: > Exception Type: OperationalError at /play_django/page/start/save/ > Exception Value: no such table: mywiki_page_tags Did you log into SQLite and see if that table exists? -- George --~--~-~--~~~---~--~~ You received this

Re: Displaying rows as columns

2009-05-02 Thread George Song
On 5/1/2009 5:47 PM, mamco wrote: > In attempting to get a better grasp of Django, I'm attempting a fairly > simple timecard app. Multiple users of a small chain of retail > stores, where occasionally the employees jump between stores(company), > and between projects and activities. > > The

Re: Displaying rows as columns

2009-05-01 Thread George Song
On 5/1/2009 5:47 PM, mamco wrote: > Hi, > In attempting to get a better grasp of Django, I'm attempting a fairly > simple timecard app. Multiple users of a small chain of retail > stores, where occasionally the employees jump between stores(company), > and between projects and activities. > >

Re: save_formset() in admin.TabularInline doesn't work.

2009-05-01 Thread George Song
On 5/1/2009 4:29 AM, eli wrote: > Hi, > > I have problem with save_form, save_model, save_formset methods in > Admin class admin.TabularInline. > > class AAdmin(admin.TabularInline): > model = A1 > extra = 3 > > def save_form(self, request, form, change): > print "form" >

Re: Validation error when uploading jpeg via admin

2009-05-01 Thread George Song
Can you try the same operation using the Django development server and see what happens? On 5/1/2009 7:19 AM, Jason Sypolt wrote: > Also, I'm going through wsgi and not mod_python. Not sure if that > makes a difference.. > > > On May 1, 10:12 am, George Song <geo...@damacy.n

Re: Create a web service for an existing stand alone python script

2009-05-01 Thread George Song
On 5/1/2009 5:13 AM, pallavi wrote: > For example lets say my python script is named "science.py" and it > reads two input files for the input data : abc.txt and xyz.txt and > after computation the output file is : output.txt If abc.txt and xyz.txt are available somehow directly on the

Re: Validation error when uploading jpeg via admin

2009-05-01 Thread George Song
On 5/1/2009 6:56 AM, Jason Sypolt wrote: > I have pil 1.1.6 installed - it can find a jpeg decoder and all tests > pass. I'm using django 1.0.2 and python 2.5 on centos 5.3. Whenever I > try to upload a jpeg via the admin (ImageField), I get the following > validation error. > > "Upload a valid

Re: Tables with same schema

2009-05-01 Thread George Song
Plain ol' Python multiple inheritance should work. Just define the fields you want in some class: {{{ class PersonMixin(object): first = models.CharField(max_length=16) last = models.CharField(max_length=16) class Person(models.Model, PersonMixin): pass class Person2(models.Model,

Django Test Coverage

2009-05-01 Thread George Song
I've decided to release the test coverage app I've been using on my projects as open source. I've packaged it as a third-party Django app for convenience. But the underlying components can be used independently from Django as well. -- George

Re: Comparing BoundField values in templates

2009-03-12 Thread George Song
I think the easier way is just to write a custom widget which subclasses RadioSelect and override the render() method to however you want to output the HTML. On Jan 19, 6:45 am, ekellner wrote: > Hi, I am having trouble working with a BoundField value in a template. > > What