Selecting multiple models in the UI, each needs to have unique "order"

2009-10-20 Thread chefsmart
I have a particular scenario that I can't seem to figure out how to accomplish in Django. I have the following models: - class Process(models.Model): name = models.CharField(max_length=50) is_active = models.BooleanField(db_index=True) class Phase(models.Model): name = models.CharFi

Re: Selecting multiple models in the UI, each needs to have unique "order"

2009-10-20 Thread Bogdan I. Bursuc
chefsmart wrote: > I have a particular scenario that I can't seem to figure out how to > accomplish in Django. > > I have the following models: - > > class Process(models.Model): > name = models.CharField(max_length=50) > is_active = models.BooleanField(db_index=True) > > class Phase(model

extends tag in template

2009-10-20 Thread knight
Hi, I have override 2 admin templates: index.html and base_site.html. The first line of index.html is: {% extends "admin/base_site.html" %} Everything works fine, but if I insert {{ MEDIA_URL }} in base_site.html, I get the following error when going to my admin page: TemplateSyntaxError at /adm

Re: Selecting multiple models in the UI, each needs to have unique "order"

2009-10-20 Thread chefsmart
Yes, I overlooked the M2M relation in my rush. Thanks for pointing that out. I would use your model representations as is, except that the order field in the intermediary model ProcessPhase would be order = models.PositiveIntegerField(unique=True) instead of order = models.PositiveIntegerField

Re: Selecting multiple models in the UI, each needs to have unique "order"

2009-10-20 Thread Bogdan I. Bursuc
chefsmart wrote: > Yes, I overlooked the M2M relation in my rush. Thanks for pointing > that out. > > I would use your model representations as is, except that the order > field in the intermediary model ProcessPhase would be > > order = models.PositiveIntegerField(unique=True) > > instead of > >

Re: extends tag in template

2009-10-20 Thread bruno desthuilliers
On 20 oct, 09:56, knight wrote: > Hi, > > I have override 2 admin templates: index.html and base_site.html. > The first line of index.html is: {% extends "admin/base_site.html" %} > Everything works fine, but if I insert {{ MEDIA_URL }} in > base_site.html, I get the following error when going to

Re: Django methodologies and best practices

2009-10-20 Thread Andy Mikhailenko
I usually start with defining goals, actors and use cases, continue with UML class diagrams and UI mockups on paper, and then transfer all that to Python in this order: models, urls, views, templates. Then I manually populate the DB with some data, dump a fixture and periodically reset the app dat

Join .Net Community

2009-10-20 Thread Shawon_
Join .Net Community This group represents the Microsoft .Net community. All .net programmers all around the world are welcome here. In this group you'll find the latest releases of .Net related products, frameworks, Upgradation, technologies, IDEs etc. You also can share your experiences and prob

Re: Join .Net Community

2009-10-20 Thread nostradamnit
No thanks On Oct 20, 12:30 pm, Shawon_ wrote: > Join .Net Community > > This group represents the Microsoft .Net community. All .net > programmers all around the world are welcome here. In this group > you'll find the latest releases of .Net related products, frameworks, > Upgradation, technolog

Re: Join .Net Community

2009-10-20 Thread Ismail Dhorat
wtf? On Tue, Oct 20, 2009 at 12:30 PM, Shawon_ wrote: > > Join .Net Community > > This group represents the Microsoft .Net community. All .net > programmers all around the world are welcome here. In this group > you'll find the latest releases of .Net related products, frameworks, > Upgradation,

Re: Join .Net Community

2009-10-20 Thread Alexandru-Emil Lupu
No thanks On Tue, Oct 20, 2009 at 1:43 PM, nostradamnit wrote: > > No thanks > > On Oct 20, 12:30 pm, Shawon_ wrote: > > Join .Net Community > > > > This group represents the Microsoft .Net community. All .net > > programmers all around the world are welcome here. In this group > > you'll find th

Re: Problem in installing database adapter.

2009-10-20 Thread Dang Lam
Thank you! I use Ubuntu 9.04, can you recommend me any corresponding Python versions? On Oct 18, 1:50 pm, Tomasz Zieliński wrote: > I don't remember how I installed it (mysqldb or python-mysqldb), > but assuming that this is the correct module, then it's possible > that it's for different Python

Re: Join .Net Community

2009-10-20 Thread Prashanth
On Tue, Oct 20, 2009 at 4:00 PM, Shawon_ wrote: > > Join .Net Community > > This group represents the Microsoft .Net community. All .net > programmers all around the world are welcome here. In this group > you'll find the latest releases of .Net related products, frameworks, > Upgradation, techno

Re: Join .Net Community

2009-10-20 Thread Михаил Лукин
burn in hell 2009/10/20 Shawon_ > > Join .Net Community > > This group represents the Microsoft .Net community. All .net > programmers all around the world are welcome here. In this group > you'll find the latest releases of .Net related products, frameworks, > Upgradation, technologies, IDEs et

Re: How to disable autoescape in django feeds?

2009-10-20 Thread Jaime Buelta
Use the filter 'safe' {{ variable | safe }} On Tue, Oct 20, 2009 at 8:31 AM, Alexey Moskvin wrote: > > Hi! > I use django feed framework to organize rss feeds for my website. > I need to put some hyperlinks to feed items, but al of them are > autoescaped ( "<" is replaced with "<" and so on). >

Re: starting a project in windows xp

2009-10-20 Thread Kevin.Gu
I think there is another way to do it -- use Exemaker. http://effbot.org/zone/django.htm On Tue, Oct 20, 2009 at 3:31 AM, Nick wrote: > > FYI, > > If anyone in general has trouble starting a new project in Windows xp, > this might help you. When I first tried creating a project, I cd'd > into th

"...where field is NULL" in Django ORM

2009-10-20 Thread Михаил Лукин
There is three ways to select NULL records from table with Django ORM: 1. Model.objects.filter(field=None) 2. Model.objects.filter(field__exact=None) 3. Model.objects.filter(field__isnull=True) They all seem to work. Which is the best way and why? -- regards, Mihail --~--~-~--~~---

ManyToMany lookups

2009-10-20 Thread ausi1972
I am trying to work out how to construct a queryset that contains multiple records for a ManyToMany field. The models are like this: class products(models.Model) name = models.CharField() categories = models.ManyToManyField(Category) class category(models.Model) name = models.Charfie

Ignore duplicty in compilemessages

2009-10-20 Thread urukay
Hi folks, is there a way how use compilemessages with ignoring duplicity translations? In my native language it's necessary to have more than one translation for particular strings. Thanks for help Radovan -- View this message in context: http://www.nabble.com/Ignore-duplicty-in-compilemessa

Re: Join .Net Community

2009-10-20 Thread Russell Keith-Magee
On Tue, Oct 20, 2009 at 7:24 PM, Михаил Лукин wrote: > burn in hell Ok - this may border on spam, but that sort of sentiment entirely uncalled for. Please refrain from posting messages like this to Django mailing lists in the future. Yours, Russ Magee %-) --~--~-~--~~~-

Re: extends tag in template

2009-10-20 Thread knight
Thanks for the reply. It doesn't matter where I put {{ MEDIA_URL }}. I get the error in any case On Oct 20, 11:09 am, bruno desthuilliers wrote: > On 20 oct, 09:56, knight wrote: > > > Hi, > > > I have override 2 admin templates: index.html and base_site.html. > > The first line of index.html i

Re: ManyToMany lookups

2009-10-20 Thread Михаил Лукин
As I know, each category has attribute product_set 2009/10/20 ausi1972 > > I am trying to work out how to construct a queryset that contains > multiple records for a ManyToMany field. > > The models are like this: > class products(models.Model) >name = models.CharField() >categories = mo

Re: "...where field is NULL" in Django ORM

2009-10-20 Thread Russell Keith-Magee
On Tue, Oct 20, 2009 at 8:21 PM, Михаил Лукин wrote: > There is three ways to select NULL records from table with Django ORM: > > 1. Model.objects.filter(field=None) > 2. Model.objects.filter(field__exact=None) > 3. Model.objects.filter(field__isnull=True) > > They all seem to work. > Which is th

Re: "...where field is NULL" in Django ORM

2009-10-20 Thread Михаил Лукин
For some reason, __exact and __isnull are described in documentation [1], while =None is not. So which of them are historical? [1] http://docs.djangoproject.com/en/dev/topics/db/queries/#topics-db-queries 2009/10/20 Russell Keith-Magee > > These three queries are all exactly the same, and if yo

Dreamhost PS installation problems.

2009-10-20 Thread wonderfullyrich
I'm trying to use a mix between the http://wiki.dreamhost.com/Django#Setup and http://webhostingreal.com/content/view/18/1/ (which looks slightly more recent then the wiki) to setup django on a PS server with Dreamhost. I'm stuck at the easy_install portion. I realize dreamhost might not be the

Inline formset question

2009-10-20 Thread Aizen
I have the following models and I'd like to use them to generate a contact form...now I know I'm suppossed to use inline formsets, but I've never been able to make heads or tails of how to make this work...I want to have the first name, last name, email, phone number, best time to contact, and the

Re: "...where field is NULL" in Django ORM

2009-10-20 Thread Russell Keith-Magee
On Tue, Oct 20, 2009 at 9:09 PM, Михаил Лукин wrote: > For some reason, __exact and __isnull are described in documentation [1], > while =None is not. So which of them are historical? As I said, __exact and __isnull are historical. The documentation you reference points out that __exact=X and =

Re: python manage.py syncdb error: sqlite3.OperationalError: unable to open database file

2009-10-20 Thread David Paccoud
Hi Selena, To avoid this problem and make your app relocable, you should not use hard coded paths. Here's what I use on my projects: from os import path rel = lambda *x: path.join(path.abspath(path.dirname(__file__)), *x) DATABASE_NAME = rel('dev.db') MEDIA_ROOT = rel('media') TEMPLATE_DIRS = (

Re: "...where field is NULL" in Django ORM

2009-10-20 Thread Michael P. Jung
Михаил Лукин wrote: > For some reason, __exact and __isnull are described in documentation > [1], while =None is not. So which of them are historical? Django pre 1.0 generated bogus SQL, when doing nullable_field=None. These days __isnull can be replaced by the expressions: filter(foo__isnul

http://www.icfshop.com Christmas bargain,nike,jordan,shoes,coach,ed hardy,bags,Special,Coming soon

2009-10-20 Thread huangzhixian2017 huangzhixian2017
Christmas is around the corner: And old customers can also enjoy the gifts sent by my company in a can also request to our company. Gifts lot,Buy more get the more。Only this site have this treatmentOur goal is "Best quality, Best reputation , Best services". Your satisfaction is our main pursue.

Django database scalability

2009-10-20 Thread 朱涛 Tower Joo
Hi ALL: We have a new django powered project which have a potential heavy-traffic characteristic(means a heavy db interaction). So we need to consider the database scalability in advance. With some researches, the following questions are still not clear to us: 1. coarse-grained: how to specify

Re: Join .Net Community

2009-10-20 Thread Masklinn
On 20 Oct 2009, at 14:49 , Russell Keith-Magee wrote: > > Ok - this may border on spam I disagree that it "borders on" spam. It is downright spam (and I'm glad my spamtrap flagged it as such and sent the original message straight to the bin). --~--~-~--~~~---~--~-

Re: "...where field is NULL" in Django ORM

2009-10-20 Thread Russell Keith-Magee
On Tue, Oct 20, 2009 at 9:51 PM, Michael P. Jung wrote: > > You're right in one thing. The whole foo=value thing is not documented. >From the "exact" subsection in http://docs.djangoproject.com/en/dev/topics/db/queries/#field-lookups """ For example, the following two statements are equivalent:

Re: starting a project in windows xp

2009-10-20 Thread Grant Livingston
Python add's itself to your path by default right? If not, it would be much more convenient just adding python to your path so you could just say "python" instead of the full path to the exe... --~--~-~--~~~---~--~~ You received this message because you are subscrib

Re: efficiently deleting content based on how old it is

2009-10-20 Thread Chris Withers
buttman wrote: > you could also do it this way: > > http://pythonblog300246943.blogspot.com/2009/09/cron-jobs-with-django-made-easy.html url whacking like that is pretty evil... Chris -- Simplistix - Content Management, Batch Processing & Python Consulting - http://www.simplistix.

Re: efficiently deleting content based on how old it is

2009-10-20 Thread Chris Withers
Shawn Milochik wrote: > I know this doesn't answer the hard part of your question, but here's > a simple way I delete old stuff from a database via an external script > that's run by cron: > > Item.objects.filter(date_updated__lte = datetime.now() - timedelta > (days = 30)).delete() Yep, th

Re: JOINs with Django ORM

2009-10-20 Thread Tomasz Zieliński
On 20 Paź, 08:37, "Michael P. Jung" wrote: > > I was unclear, but SQL should explain what I want to do - select > > all ObjectRevision-s that are latest in Object-s that they belong to. > > Moreover, I want to do this in with one ORM query, without resorting > > to SQL or splitting the query to

Re: "...where field is NULL" in Django ORM

2009-10-20 Thread Михаил Лукин
As I said in my first post, I understand that all three ways are correct. I just wanted to know "the best", which means that it should always give the same results and should not be deprecated in the future. If I understand you correctly, "=None" is most recent implementation of "is null" and (for

Re: JOINs with Django ORM

2009-10-20 Thread Michael P. Jung
mp> I'd go for a denormalized database: mp> (...) tz> I'm aware of this solution, in fact I was using it. Unfortunately I tz> had problems with deleting objects with this circular dependency, but tz> maybe I was overlooking something (db we're using is MySQL 5). You're right. You have to make su

Re: DRY: max length not taken from Model.field when using ModelForm

2009-10-20 Thread Karen Tracey
On Thu, Oct 15, 2009 at 12:30 PM, Gerard wrote: > > Hi All, > > It seems the max_lenght from the model definition is not respected > thoughout > the form that's created when using Modelform. > > company_name = models.CharField(max_length=75) > > Is this correct or am I missing something? > T

Re: edit basic user data not validating on website front end

2009-10-20 Thread Karen Tracey
On Fri, Oct 16, 2009 at 8:04 AM, grimmus wrote: > > Hi, > > On my website i have a edit profile page, this enables users to edit 4 > fields : username, first name, last name and email address. For some > reason the form never validates, is it not enough just to pass the 4 > fields i want to edit

Re: Problem with filter_horizontal

2009-10-20 Thread Karen Tracey
On Sun, Oct 18, 2009 at 12:52 PM, eric woodworth wrote: > Hi, > > This is my first django app and I can't seem to get filter_horizontal > to work correctly. I've seen other people asking about this but I don't see > any answers in an hour of searching. Can anybody give me some insight into >

Re: TemplateDoesNotExist at /admin/ on Centos with Django 1.1.1

2009-10-20 Thread Karen Tracey
On Sun, Oct 18, 2009 at 8:41 PM, Christophe Pettus wrote: > > Greetings, > > I'm installing Django on a Centos 5.3 system, running under mod_wsgi > on Apache, using Django 1.1.1. In a very basic install, when I > attempt to access the /admin/ URL, I get the above error... but the > templates are

Re: Help with splicing models to a legacy DB, please

2009-10-20 Thread Karen Tracey
On Mon, Oct 19, 2009 at 5:03 PM, John Handelaar wrote: > > Hello > > For reasons I won't bore you with, a Mysql legacy DB *whose schema I > cannot alter* contains (inter alia) two tables. I'm trying to write > an alternative front-end to this DB in Django which would be > read-only. > > tableone

DRY (or how can I stop repeating myself)

2009-10-20 Thread Михаил Лукин
There is a couple of models in auth application to check user permissions in Django. But sometimes we need to grant permissions per instance, not per model. Example: *class Employee(django.contrib.auth.models.User): pass class Task(models.Model): summary = models.CharField(max_length=50) des

Re: ManyToMany lookups

2009-10-20 Thread r_f_d
Why not do this: for p in products.objects.all(): for c in p.categories.all(): print p,' - ', c -richard On Oct 20, 7:57 am, Михаил Лукин wrote: > As I know, each category has attribute product_set > > 2009/10/20 ausi1972 > > > > > > > I am trying to work out how to construct a q

Re: DRY (or how can I stop repeating myself)

2009-10-20 Thread Javier Guerra
On Tue, Oct 20, 2009 at 1:47 PM, Михаил Лукин wrote: > What is your best practice in such situations? write a custom tag -- Javier --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to

Re: DRY (or how can I stop repeating myself)

2009-10-20 Thread Михаил Лукин
Good idea, thanks Javier. 2009/10/20 Javier Guerra > > On Tue, Oct 20, 2009 at 1:47 PM, Михаил Лукин > wrote: > > What is your best practice in such situations? > > write a custom tag > > -- > Javier > > > > -- regards, Mihail --~--~-~--~~~---~--~~ You receiv

Re: DRY (or how can I stop repeating myself)

2009-10-20 Thread Mike Ramirez
On Tuesday 20 October 2009 11:47:51 Михаил Лукин wrote: > Next, we don't want 'edit' and 'change status' links to always appear on > task detail page, so we pass 'can_edit' and 'can_change_status' flags to > the template. But we never trust the browser, so in views 'task_edit' and > 'task_change

Re: DRY (or how can I stop repeating myself)

2009-10-20 Thread Михаил Лукин
Actually, I told about server-side form processing, not client-side. When client posts data, I always check permissions in a VIEW that receives it. 2009/10/20 Mike Ramirez > On Tuesday 20 October 2009 11:47:51 Михаил Лукин wrote: > > > Next, we don't want 'edit' and 'change status' links to alwa

inlineformset or? link to three different models...

2009-10-20 Thread Mitch Anderson
Hi, I'm still very much a noob for django... as I'm a systems guy for my day job... as my problem will illustrate... Im not sure how I should go about this really... I've tired several ways and I've been looking through the archives and browsing the web for the last two days I'm trying to t

Unittest, fixture and permission

2009-10-20 Thread Brice
Hello everybody, I'm facing a delicate problem. I want to make ensure the security of my app and I created a unitest to do so. To make it easy, I was thinking about fixture, but they don't support model permission evolution and create conflict over time. So I add a function linked to the syncdb

Apache2+mod_wsgi autoreload?

2009-10-20 Thread Михаил Лукин
./manage runserver is OK for debugging purposes... unless you use server-specific features, in my case - NTLM authentication. When deploying Django project with Apache2+mod_wsgi, I need to `rcapache2 reload` to apply changes in Python modules (while `manage runserver` does this automaticaly). This

Re: efficiently deleting content based on how old it is

2009-10-20 Thread Jaime Buelta
When I had to do this kind of tasks, I've added a new management command and run it from the cron (or manually any time you need it, with params, etc). You can run it calling python manager.py miCommand parameters The official documentation is not very complete, which is rare, but there are some

Re: Apache2+mod_wsgi autoreload?

2009-10-20 Thread Graham Dumpleton
On Oct 21, 4:00 pm, Михаил Лукин wrote: > ./manage runserver is OK for debugging purposes... unless you use > server-specific features, in my case - NTLM authentication. When deploying > Django project with Apache2+mod_wsgi, I need to `rcapache2 reload` to apply > changes in Python modules (whi

Re: Apache2+mod_wsgi autoreload?

2009-10-20 Thread Graham Dumpleton
On Oct 21, 5:07 pm, Graham Dumpleton wrote: > On Oct 21, 4:00 pm, Михаил Лукин wrote: > > > ./manage runserver is OK for debugging purposes... unless you use > > server-specific features, in my case - NTLM authentication. When deploying > > Django project with Apache2+mod_wsgi, I need to `rcap

Re: ManyToMany lookups

2009-10-20 Thread koenb
On 20 okt, 21:19, r_f_d wrote: > Why not do this: > > for p in products.objects.all(): >     for c in p.categories.all(): >          print p,' - ', c > > -richard > > On Oct 20, 7:57 am, Михаил Лукин wrote: > This will obviously leave you with a lot of queries. Take a look at eg django-selectre