Re: A view associated with a lot of urls

2011-11-29 Thread Reinout van Rees
On 29-11-11 21:37, Nolhian wrote: However with that, there is no way for example to make a difference between "there is no items in this category" and "this category doesn't exist" ! Probably not a problem. How are people ending up on those URLS? Not by guessing, I think. So you probably have

Re: A view associated with a lot of urls

2011-11-29 Thread Nolhian
>No I don't know what your business logic for the view/model would be. >I was just showing an example of how you could take keywords from your >request url and map them to your models to display results to the user >without having to hard-code them in your urls or settings or whatever. Oh okay :)

MS Access integration with DJango through conversion to (Postgres or MySQL) xor direct interaction

2011-11-29 Thread Alec Taylor
Good afternoon, Is there an ORM library for python/django which integrates with MS Access? - I know SQLalchemy dropped support after 0.4, but maybe there's another to use? Alternatively how would I convert one to PostgreSQL or MySQL then interpret it into ORM syntax for use in i.e. SQLalchemy?

Re: A view associated with a lot of urls

2011-11-29 Thread DrBloodmoney
On Tue, Nov 29, 2011 at 3:37 PM, Nolhian wrote: > Thanks ! > > So you'll not check if the category/item exists ( if a user enter a > bad url ), you'll just hit the database to check if it does in fact > exists ? No I don't know what your business logic for the view/model

Re: A view associated with a lot of urls

2011-11-29 Thread Nolhian
Thanks ! So you'll not check if the category/item exists ( if a user enter a bad url ), you'll just hit the database to check if it does in fact exists ? However with that, there is no way for example to make a difference between "there is no items in this category" and "this category doesn't

Re: Nginx - How to configure the virtual.conf to serve a Django application

2011-11-29 Thread DrBloodmoney
On Tue, Nov 29, 2011 at 3:05 PM, Andre Lopes wrote: > I'm trying to serve a Django application to production. I have > installed Gunicorn and now I need to setup a Nginx Virtual Host. I'm > kind of lost on how to configure the "virtual.conf" from Nginx. I just > want to

Nginx - How to configure the virtual.conf to serve a Django application

2011-11-29 Thread Andre Lopes
I'm trying to serve a Django application to production. I have installed Gunicorn and now I need to setup a Nginx Virtual Host. I'm kind of lost on how to configure the "virtual.conf" from Nginx. I just want to use Nginx as proxy, I don't want to configure deplyment scripts for now. I have this

Re: A view associated with a lot of urls

2011-11-29 Thread DrBloodmoney
On Tue, Nov 29, 2011 at 2:19 PM, Nolhian wrote: > Thanks you for your answer, yes I plan on using different models for > the lookups. But I'm confused, is that a yes to my question, Lists/ > dicts are the way to go here ? I would not do it that way. Seems incredibly brittle

Re: A view associated with a lot of urls

2011-11-29 Thread Nolhian
Thanks you for your answer, yes I plan on using different models for the lookups. But I'm confused, is that a yes to my question, Lists/ dicts are the way to go here ? On Nov 29, 7:03 pm, Nan wrote: > Django's regular-expression based URL dispatcher is designed to do > this

Re: A view associated with a lot of urls

2011-11-29 Thread Nolhian
Thanks you for your answer, yes I plan on using different models for the lookups. But I'm confused, is that a yes to my question, Lists/ dicts are the way to go here ? On Nov 29, 7:03 pm, Nan wrote: > Django's regular-expression based URL dispatcher is designed to do > this

Re: A view associated with a lot of urls

2011-11-29 Thread Nan
Django's regular-expression based URL dispatcher is designed to do this directly; and you might want to use a model (database table) for each of your lookups. The third part of the tutorial [1] addresses this. [1] https://docs.djangoproject.com/en/dev/intro/tutorial03/ On Nov 29, 3:30 am,

Re: Bulk import of data

2011-11-29 Thread Fabio Natali
On 11/28/2011 09:28 AM, Anler Hernandez Peral wrote: Hi, this is probably not your case, but in case it is, here is my story: Creating a script for import CSV files is the best solution as long as they are few, but in my case, the problem was that I need to import nearly 40 VERY BIG CSV files,

Re: Bulk import of data

2011-11-29 Thread Fabio Natali
On 11/27/2011 07:56 PM, Andre Terra wrote: This should be run asynchronously (i.e. celery) when importing large files. If you have a lot of categories/subcategories, you will need to bulk insert them instead of looping through the data and just using get_or_create. A single, long transaction

Re: Bulk import of data

2011-11-29 Thread Fabio Natali
On 11/26/2011 11:44 PM, Petr Přikryl wrote: import csv data = csv.reader(open('/path/to/csv', 'r'), delimiter=';') for row in data: category = Category.objects.get_or_create(name=row[0]) sub_category = SubCategory.objects.get_or_create(name=row[1], defaults={'parent_category': category})

Re: Newbie question on re-defining an XML schema in my Django data model...

2011-11-29 Thread Brian Schott
Marc, There is a couple of ways to do this on top of the Django ORM. You probably want to use a many-to-many relationship with an extra index field. https://docs.djangoproject.com/en/dev/topics/db/models/#extra-fields-on-many-to-many-relationships class SingularWorkFlow(models.Model):

Re: Newbie question on re-defining an XML schema in my Django data model...

2011-11-29 Thread Tom Evans
On Tue, Nov 29, 2011 at 3:44 PM, Marc Edwards wrote: > I need some help in resetting my thinking on creating my Django data > model. > > I have previously created an XML schema definition for my data model, > but am now trying to re-create this XML data model in a Django

Newbie question on re-defining an XML schema in my Django data model...

2011-11-29 Thread Marc Edwards
I need some help in resetting my thinking on creating my Django data model. I have previously created an XML schema definition for my data model, but am now trying to re-create this XML data model in a Django data model. In my XML schema, I had defined "collections" of XML complex types that

Re: What server configuration should I use for a Django site like this?

2011-11-29 Thread Andre Lopes
Hi Tiago, Thanks for the reply. What alternatives I have? Can you send me a few hosts that you consider cheap and good? I have some bad experiences with shared hosting... Best Regards, On Tue, Nov 29, 2011 at 2:39 PM, Tiago Almeida wrote: > Does it need to be a

Re: Referring to same model records as a parent

2011-11-29 Thread Andre Terra
Just use django-mptt [1][2], especially after version 0.5 It will do exactly what you need, except better! Cheers, AT [1] http://django-mptt.github.com/django-mptt/ [2] http://django-mptt.github.com/django-mptt/overview.html#what-is-django-mptt On Tue, Nov 29, 2011 at 12:22 PM, fabrixxm

Re: What server configuration should I use for a Django site like this?

2011-11-29 Thread Tiago Almeida
Does it need to be a vps? there are much cheaper shared hosting alternatives for django. I don't recommend going forward with apache with so few ram, use nginx or lightppd. Best regards, On Nov 28, 4:30 pm, Andre Lopes wrote: > I need to put in production a Django

Re: Referring to same model records as a parent

2011-11-29 Thread fabrixxm
On 28 Nov, 20:25, Swaroop Shankar V wrote: > Hi, > I am trying to implement a menu system for my project which would enable > the admin to create menu's that will be displayed on the webpage. So i > should be able to create sub-menus which will have a parent menu.

Admin, Save

2011-11-29 Thread gintare
I am not able to save changes through Admin page in the model instance. The Admin page has such levels: Project>> Model >> Model Instance. The option save is at Model and Model Instance levels. I can save changes only in the last Model Instance level. I would like to be able to save changes

Re: Customized authentication backend.

2011-11-29 Thread Andre Terra
Hello, Shaini Please read https://code.djangoproject.com/wiki/UsingTheMailingList Sincerely, André Terra On Tue, Nov 29, 2011 at 5:21 AM, shaini sasidhar wrote: > Hi.. > > Need to customize authentication backend in my Django > project.Also want to

Re: django tests. where to create users

2011-11-29 Thread Piotr Zalewa
I use all solutions, depending on the needs. When I'm testing a usage of many objects I use fixtures (also with users as I'm "pretending" that users created them) When there is a test involving a user I create this object, either in test or the setUp. On 11/28/11 01:58, Gelonida N wrote:

Re: django tests. where to create users

2011-11-29 Thread Tom Christie
What's wrong with just creating them in the .setUp()? Don't sweat the small amount of time it'll take to re-create the users on each test run, it's almost certainly not worth worrying about. -- You received this message because you are subscribed to the Google Groups "Django users" group. To

A view associated with a lot of urls

2011-11-29 Thread Nolhian
Hello, I've got a view associated with a lot of urls which have 2 variables ( like /computer/keyboard, /animal/dog and so on ). I thought of doing a regex like [a-z]/a-z]/$ and make 2 lists or dicts at the beginning of the view and check if the 2 variables are in these dicts or respond with a