weird django orm behavior

2007-08-06 Thread james_027
Hi, I have this models ... class Employee(models.Model): emplyoee_contract = models.ForeignKey('EmployeeContract', null=True, related_name='contracted_employee') employee_assignment = models.ForeignKey('EmployeeAssignment', null=True, related_name='assigned_employee') class

Re: How to split up views into different files...

2007-08-06 Thread Doug B
You can make a 'views' subfolder in your app folder, and make sure it contains an __init__.py file (can be empty). My personal opinion is that going overboard trying to make your python file structure 'neater' will eventually bite you in the ass. It wasn't too bad for views, but became import

Re: How to split up views into different files...

2007-08-06 Thread oggie rob
There are no restrictions at all on this. Remember that the view is called via urls.py, so you define your different views & files there. Just a point of interest, though - models don't always match up with views. In fact, most of my views contain at least two or three models. Rather than break

How to split up views into different files...

2007-08-06 Thread [EMAIL PROTECTED]
I'd like to have a separate view files for each model just to make everything a little neater. What's the best way to do this? --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this

Re: full-text indexing

2007-08-06 Thread Russell Keith-Magee
On 8/7/07, cesco <[EMAIL PROTECTED]> wrote: > > Hi, > > is there any rough estimate on when the full-text indexing branch will > be integrated into trunk? The short answer is that there isn't really a rough estimate for anything on Django - and especially not on branch merges. It will be done

Re: XML serializer

2007-08-06 Thread Russell Keith-Magee
On 8/6/07, birkin <[EMAIL PROTECTED]> wrote: > > > The Django serializers accept any iterable, not just query sets. You > > can pass in any list or set of Django object instances, and they > > willserializefine. > > > I thought the same thing from this line in the serialization > documentation:

Re: DB queries with filter and exclude

2007-08-06 Thread [EMAIL PROTECTED]
Wow, thanks for the reply. I can't get this to work though--I get an "iteration over non-sequence". Can you take a look? model... class Author(models.Model): first_name = models.CharField(maxlength=30) last_name = models.CharField(maxlength=40) def __str__(self):

Re: full-text indexing

2007-08-06 Thread ludo
On Aug 6, 7:47 pm, cesco <[EMAIL PROTECTED]> wrote: > Hi, > > is there any rough estimate on when the full-text indexing branch will > be integrated into trunk? You can already use full text indexing in Django with the excellent Sphinx search engine [1]. There's some code on DjangoSnippets [2],

Re: full-text indexing

2007-08-06 Thread Amirouche
I think that full text search works with mysql and with a patched version for postgresql [1] (prefered way!) But this is not my prefered way to use full text search I think, because: 1. no ranking by revelance support (at least for postgres) 2. most of the time you want to search throught a model

Re: DB queries with filter and exclude

2007-08-06 Thread [EMAIL PROTECTED]
Given your view code above, what would the template code look like to return something like this: object | tags ---+-- obj1 | food, meat obj2 | food, meat obj3 | food obj4 | food, cake obj5 | food, cake obj6 | food, vegetable obj7 | garden, vegetable On Aug 6,

Django/Ellington online internships/San Diego Reader

2007-08-06 Thread xmlman
Django/Ellington online internships now available at the San Diego Reader, America's largest alternative newsweekly. Contact [EMAIL PROTECTED] --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group.

Re: DB queries with filter and exclude

2007-08-06 Thread Tim Chase
> Now I want to get all objects, which have set tag "food" *and* *have > not* set tag "cake". > > This get all objects with tag="food" set (obj1..obj5): > >Obj.objects.filter(tags__in=[Tags.objects.filter(name='food')]) > > This get all objects, which haven't set tag "cake" (obj1..obj3,

Re: Accessing data from a tuple in a template?

2007-08-06 Thread daev
http://www.djangoproject.com/documentation/db-api/#get-foo-display --~--~-~--~~~---~--~~ 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

Accessing data from a tuple in a template?

2007-08-06 Thread Shane Graber
On one of my models (in models.py), I have the something like the following defined below a class: STATUS_CHOICES = ( (1, 'Ham'), (2, 'Turkey'), (3, 'Beef'), ) The Django admin interface is smart enough to pick up the text from the tuple and use it when displaying the

DB queries with filter and exclude

2007-08-06 Thread Michal
Hello, I have defined two models, one reffered from another with ManyToManyField. This referrer is used to categorising objects with 0, 1 or more tags. Now I want to get all objects, which have set tag "food" *and* *have not* set tag "cake". Example: object | tags ---+-- obj1

Re: DB ProgrammingError

2007-08-06 Thread James Bennett
On 8/6/07, Michal <[EMAIL PROTECTED]> wrote: > Is there some similar function please? (I read somewhere how to do this, > but forgot it, and solution wasn't so straightforward). You will need to find some way to issue a ROLLBACK statement to your database. One such way is from django.db import

DB ProgrammingError

2007-08-06 Thread Michal
Hello, is there some shortcut in Django to "reset" database engine to accept next DB queries, when I receive error like "ProgrammingError: ERROR: current transaction is aborted, commands ignored until end of transaction block" in shell? I often meet situation, when try some new code in

Re: full-text indexing

2007-08-06 Thread Jarek Zgoda
On 6 Sie, 19:47, cesco <[EMAIL PROTECTED]> wrote: > is there any rough estimate on when the full-text indexing branch will > be integrated into trunk? Well, at least PyLucene full-text search code is unusable in current form found in this branch. Any threading GCJ-compiled code can not be

Re: The Django Book

2007-08-06 Thread Jeremy Dunck
On 8/6/07, Tim Chase <[EMAIL PROTECTED]> wrote: > My understanding is that the djangobook project has either > > 1) been put on hold until the 1.0 API solidifies or > 2) doing some pre-press stuff that's not interesting and thus not > public > There's some non-public pre-press stuff going on,

Django Admin Sorting

2007-08-06 Thread Chris Sabanty
Hey all, A few questions about sorting fields with automatically generated Django admin pages. 1. When you want to sort by a field generated by a function, is it possible to have it sort both ascending and descending? I have a column called name, which is populated by a function that appends

Re: Do I have to send shopping cart data to every template in my app?

2007-08-06 Thread oggie rob
No, you don't need to use the same template. You are just filling in some data on every request using the context processor. Its like this: 1) Write a context processor that adds shopping cart info to every context. Now it can be accessed via {{ cart.items }} or however you set it up 2) Write

Re: The Django Book

2007-08-06 Thread Tim Chase
> I hope the community here knows the answer to this question: is this > gorgeous project available at http://www.djangobook.com/en/beta/ not > dead? > > It's very sad to see that it hasn't been updated since January. he's resting. Remarkable book, the Norwegian Django book. 'e's stunned.

Re: The Django Book

2007-08-06 Thread Greg Donald
On 8/6/07, Mourner <[EMAIL PROTECTED]> wrote: > I hope the community here knows the answer to this question: is this > gorgeous project available at http://www.djangobook.com/en/beta/ not > dead? > > It's very sad to see that it hasn't been updated since January. You get what you pay for. And

The Django Book

2007-08-06 Thread Mourner
Hi, I hope the community here knows the answer to this question: is this gorgeous project available at http://www.djangobook.com/en/beta/ not dead? It's very sad to see that it hasn't been updated since January. --~--~-~--~~~---~--~~ You received this message

Re: startproject errors with Ubuntu

2007-08-06 Thread john
On Aug 6, 9:48 am, Brett Parker <[EMAIL PROTECTED]> wrote: > On Mon, Aug 06, 2007 at 06:07:16AM -0700, john wrote: > > > On Aug 5, 10:46 pm, "James Bennett" <[EMAIL PROTECTED]> wrote: > > > On 8/5/07, john <[EMAIL PROTECTED]> wrote: > > > > > thks - the tutorial shows the .py extension and that

full-text indexing

2007-08-06 Thread cesco
Hi, is there any rough estimate on when the full-text indexing branch will be integrated into trunk? Thanks Francesco --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group,

Re: Using filter(...) to bring back all records?

2007-08-06 Thread Tim Chase
> I have a form that will contain 3 select input types. The user is > going to have the ability to narrow down the products by selecting a > value in these 3 select boxes (Price, Size, Color). However, the user > also has the ability to not select anything. In this case I would > want to

Re: Using filter(...) to bring back all records?

2007-08-06 Thread Tõnis Kevvai
You could try this: kwargs = {} if request['price']: kwargs['id'] = request['price'] a = Price.objects.filter(**kwargs) -- Tõnis Kevvai "How can entropy be reversed?" On 8/6/07, Greg <[EMAIL PROTECTED]> wrote: > > Hello, > I have a form that will contain 3 select input types. The user is

Using filter(...) to bring back all records?

2007-08-06 Thread Greg
Hello, I have a form that will contain 3 select input types. The user is going to have the ability to narrow down the products by selecting a value in these 3 select boxes (Price, Size, Color). However, the user also has the ability to not select anything. In this case I would want to return

Re: auth system - check if user already exists

2007-08-06 Thread Aljosa Mohorovic
On Aug 6, 4:55 pm, LaundroMat <[EMAIL PROTECTED]> wrote: > Are you sure you want to avoid that? I remember somebody here linking > to an article where this wasn't advised, because it's (apparently) > quite common for members of the same household to register with the > same e-mail address (but

Re: DateField() , AttributeError: 'str' object has no attribute 'strftime'

2007-08-06 Thread justquick
I have recently been working on a model and found this problem: class Image(Model): name = CharField(maxlength=255) owner = ForeignKey('user') file = ImageField(upload_to='Image/%Y-%m/', blank=True, null=True) description = TextField() datetime =

Re: XML serializer

2007-08-06 Thread birkin
Russ (and others), > The Django serializers accept any iterable, not just query sets. You > can pass in any list or set of Django object instances, and they > willserializefine. > > Yours, > Russ Magee %-) I thought the same thing from this line in the serialization documentation: (Actually,

Re: auth system - check if user already exists

2007-08-06 Thread LaundroMat
Are you sure you want to avoid that? I remember somebody here linking to an article where this wasn't advised, because it's (apparently) quite common for members of the same household to register with the same e-mail address (but with another username ofcourse). On Aug 6, 12:02 pm, Aljosa

Re: startproject errors with Ubuntu

2007-08-06 Thread Brett Parker
On Mon, Aug 06, 2007 at 09:53:02AM -0400, Forest Bond wrote: > On Sun, Aug 05, 2007 at 11:46:45PM -0500, James Bennett wrote: > > > > On 8/5/07, john <[EMAIL PROTECTED]> wrote: > > > thks - the tutorial shows the .py extension and that was giving the > > > error. > > > > The file's name is

Re: startproject errors with Ubuntu

2007-08-06 Thread Forest Bond
On Sun, Aug 05, 2007 at 11:46:45PM -0500, James Bennett wrote: > > On 8/5/07, john <[EMAIL PROTECTED]> wrote: > > thks - the tutorial shows the .py extension and that was giving the > > error. > > The file's name is 'django-admin.py', not 'django-admin', and the > tutorial is correct; the

Re: startproject errors with Ubuntu

2007-08-06 Thread Brett Parker
On Mon, Aug 06, 2007 at 06:07:16AM -0700, john wrote: > > On Aug 5, 10:46 pm, "James Bennett" <[EMAIL PROTECTED]> wrote: > > On 8/5/07, john <[EMAIL PROTECTED]> wrote: > > > > > thks - the tutorial shows the .py extension and that was giving the > > > error. > > > > The file's name is

Re: django app for managing sending email to users...

2007-08-06 Thread Fabien Schwob
Hello, > I've set up django-mailer at Google Code: > > http://code.google.com/p/django-mailer/ > > and written down a bunch of notes on the home page about use cases > and functional requirements. > > If no one objects, we can continue discussion on this list, although > I'm happy to start up

Re: Do I have to send shopping cart data to every template in my app?

2007-08-06 Thread Greg
Oggie, Thanks for the reply. So you're saying that it would be better to send my shopping cart data to every template through my all my view's? If that's the case then I assume there is no way to send request.session information using a custom template? Thanks On Aug 3, 4:36 pm, oggie rob

Re: startproject errors with Ubuntu

2007-08-06 Thread john
On Aug 5, 10:46 pm, "James Bennett" <[EMAIL PROTECTED]> wrote: > On 8/5/07, john <[EMAIL PROTECTED]> wrote: > > > thks - the tutorial shows the .py extension and that was giving the > > error. > > The file's name is 'django-admin.py', not 'django-admin', and the > tutorial is correct; the problem

Re: Replying to spam messages

2007-08-06 Thread Chris Hoeppner
Sorry, Russ. Won't happen again :) 2007/8/6, Russell Keith-Magee <[EMAIL PROTECTED]>: > > On 8/6/07, Chris Hoeppner <[EMAIL PROTECTED]> wrote: > > > > I *hate* spammers. > > And I like ponies. > > You aren't alone in hating spam, but unfortunately, its the price you > pay for having an open

Re: Django and mod_proxy

2007-08-06 Thread Przemek Gawronski
> Is that running by runserver:8000? Yep! > Is your django dev server serving static files? Yes, django server is serving static files, in my urlpatterns = patterns('', (r'^js/(?P.*)$', 'django.views.static.serve',{'document_root': '/home/django/work/fw/media/'}), (r'^css/(?P.*)$',

Re: Django : generic view object_list

2007-08-06 Thread Nebojša Đorđević
On 06.08.2007., at 14:12, Marco A. wrote: > I have created a view: > > (r'^$', 'django.views.generic.list_detail.object_list', info_dict), > > In the template I have : > > this is just a test, ! > > {% if error_message %}{{ error_message }}{% > endif %} > > > > {% for User in info_dict %} {%

Django : generic view object_list

2007-08-06 Thread Marco A.
Hi to all , I have created a view: (r'^$', 'django.views.generic.list_detail.object_list', info_dict), In the template I have : this is just a test, ! {% if error_message %}{{ error_message }}{% endif %} {% for User in info_dict %} aaa {{ User.user }} {% endfor %} I cant see ,

Re: Problem with __setattr__ and __getattribute__

2007-08-06 Thread Matti Haavikko
Hi, I asked the same question earlier. When ID is set to None and object is saved, the M2M fields are not copied. They must be copied separately. Caveats: the code below uses django internals and is very lightly tested. def copy_m2m_fields(src, dst): for m2m_field in

Re: Menu implementation

2007-08-06 Thread Lic. José M. Rodriguez Bacallao
yes On 7/18/07, Carl Karsten <[EMAIL PROTECTED]> wrote: > > > Lic. José M. Rodriguez Bacallao wrote: > > Have anybody implemented a tree with django, for example, a menu? > > > > tree = ui or data structurer? (guessing the answer is yes to both) > > Carl K > > > > -- Lic. José M. Rodriguez

Re: related_name

2007-08-06 Thread Lic. José M. Rodriguez Bacallao
right now, I find out how but, anyway, I'll give U an example: every ForeigmKey have a related_name parameter in its constructor, the problem is how to change that value once we construct the ForeignKey object. I did so changing the value of the: foreignkey_object.rel.related_name at runtime. On

How to specify engine type for particular table?

2007-08-06 Thread Peter Melvyn
Hi all, I operate MySQL server with default-storage-engine set to InnoDB. But I need full text search on some tables, which is unfortunatelly supported by MyISAM engine only. Is there a way to specify ENGINE=MyISAM option appended to CREATE TABLE DDL command generated by manage.py? Thanks,

Re: MySQL and InnoDB

2007-08-06 Thread Matti Haavikko
Hi, Can you get the same result with "default-storage-engine=InnoDB" in your my.cnf? - Haavikko Rob Hudson wrote: > 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

Replying to spam messages

2007-08-06 Thread Russell Keith-Magee
On 8/6/07, Chris Hoeppner <[EMAIL PROTECTED]> wrote: > > I *hate* spammers. And I like ponies. You aren't alone in hating spam, but unfortunately, its the price you pay for having an open mailing list. Replying to these messages doesn't help to stop the problem - it makes it WORSE it two very

Re: PAK Host Online(PHO) - Web Hosting, Free Domain Registration /Transfer, Website Builder & Web Marketing in Pakistan, Karachi, Lahore, Islamabad & Rawalpindi at http://www.pakhostonline.com/

2007-08-06 Thread Chris Hoeppner
I *hate* spammers. 2007/8/5, koom2020 <[EMAIL PROTECTED]>: > > PAKHostOnline.com offered Pakistan No.1 Web Hosting, DOMAIN > Registration / Transfer, 99% UP-Time, 24/7 Technical Support at > http://www.pakhostonline.com/ > > > > > -- Best Regards, Chris Hoeppner - www.pixware.org // My weblog

Re: mod_python/django problems

2007-08-06 Thread Gábor Farkas
Jacob Kaplan-Moss wrote: > On 8/3/07, Aljosa Mohorovic <[EMAIL PROTECTED]> wrote: >> on few blogs/web sites it is stated that > 30 django sites on one >> server running apache/mod_python have some issues, like untraceable >> errors and wrong site displaying for some domain. >> any comments on

Re: mod_python/django problems

2007-08-06 Thread Gábor Farkas
Matt Davies wrote: > We've got over 70 sites running on lighttpd, no problems at all. > with fastcgi/flup? gabor --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send

Re: database replication/failover...

2007-08-06 Thread moe
hi gabor, On Mon, Aug 06, 2007 at 11:02:08AM +0200, Gábor Farkas wrote: > > hi, > > how do/did you approach/solve the "what happens if the database (server) > dies?" problem? > > what kind of replication/failover solutions do you use? > (i'm primarily interested in postgres..) > > i'm not

Re: auth system - check if user already exists

2007-08-06 Thread Aljosa Mohorovic
i'm checking username and email because i want to avoid situations where some user registers with same email using different username. Aljosa --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group.

Re: mod_python/django problems

2007-08-06 Thread David Reynolds
On 4 Aug 2007, at 11:44 am, Graham Dumpleton wrote: In your Apache configuration, do you have multiple VirtualHost definitions for sites under the same parent domain and have a ServerAlias directive in any which contains a wildcard which would match a different VirtualHost containers

database replication/failover...

2007-08-06 Thread Gábor Farkas
hi, how do/did you approach/solve the "what happens if the database (server) dies?" problem? what kind of replication/failover solutions do you use? (i'm primarily interested in postgres..) i'm not talking about database-replication solutions for performance reasons (scaling etc..). i

Enjoy it !

2007-08-06 Thread [EMAIL PROTECTED]
Enjoy it ! 1) http://www.mmopawn.com 2) http://www.mmopawn.com 3) http://www.mmopawn.com 4) http://www.mmopawn.com 5) http://www.mmopawn.com 6) http://www.mmopawn.com 7) http://www.mmopawn.com a good site about world of warcraft -

Re: auth system - check if user already exists

2007-08-06 Thread LaundroMat
Of the top of my head, but would the following be helpful? user, new = User.objects.get_or_create(username = user, email = email) The function returns either: - a new user object and True if the user didn't exist yet (and had to be created); - an object with existing user data and False. Mind

Re: elseif or elseifqual or elseifnotequal

2007-08-06 Thread james_027
hi kai! thanks a lot. this will help a lot. cheers, james On Aug 6, 4:02 pm, "Kai Kuehne" <[EMAIL PROTECTED]> wrote: > Hi James, > > On 8/6/07, james_027 <[EMAIL PROTECTED]> wrote: > > > Just want to confirm if elseif and the alike doesn't exist in django's > > template. > > > What tricks

Re: Generating charts with ReportLab

2007-08-06 Thread Ben Ford
Hi Carole, Just FYI as they are kind of related topics, I've created a project called django-reports with some of my code for reporting on your django objects. I thought you might find it interesting and integration with reportlabs would be a cool feature

Re: Something like a mini Crystal Reports with Django

2007-08-06 Thread Ben Ford
Hi again guys, I've created a google code project called django-reportsto share my work thus far. As I mention on the welcome page, it's far from complete, but it all works on my machine. I'll try and whip up some documentation ASAP to help people get up

Re: elseif or elseifqual or elseifnotequal

2007-08-06 Thread Kai Kuehne
Hi James, On 8/6/07, james_027 <[EMAIL PROTECTED]> wrote: > Just want to confirm if elseif and the alike doesn't exist in django's > template. > > What tricks could be give to newbies if something like is needed ... Is switch ok? :) http://www.djangosnippets.org/snippets/300/

elseif or elseifqual or elseifnotequal

2007-08-06 Thread james_027
Hi, Just want to confirm if elseif and the alike doesn't exist in django's template. What tricks could be give to newbies if something like is needed ... if bool: elseif bool: elseif boo: it could be not nice to do something like this in django's template {% if bool %} {% else %}

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 = {

Re: Django tutorial with SVN trunk: descriptor 'upper' requires a 'str' object but received a 'unicode'

2007-08-06 Thread Brian Duff
Well... this patch got me past it. It seems that some of the table names are unicode and other table names are str. I wonder if this is because I upgraded my django version part way through the tutorial... --- management.py (revision 5818) +++ management.py (working copy) @@ -65,11

Re: Without Apache

2007-08-06 Thread KpoH
Artiom Diomin пишет: > webserver: nginx with fastcgi > > -- Artiom Diomin, Development Dep, "Comunicatii Libere" S.R.L. http://www.asterisksupport.ru http://www.asterisk-support.com --~--~-~--~~~---~--~~ You received this message because you are subscribed