Make a new model outside of models.py

2010-02-11 Thread Sameer Rahmani
Hi , is there any way to build a new model from outside of models.py ? or in other application ? i want to build a model for a class for each application -- lxsameer -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send

Re: having an ManyToMany field, and have it optional

2010-02-11 Thread Atamert Ölçgen
On Thursday 11 February 2010 08:26:10 iliveinapark wrote: > Both are required for a ForeignKey or ManyToManyField to be empty, ie: > > class GoalTag(models.Model): > goals = models.ManyToManyField(Goal, blank=True, null=True,) That is not true. Check contrib apps for examples. -- Saygıları

Re: MultiValueField & MultiWidgets in Django Admin

2010-02-11 Thread bruno desthuilliers
On Feb 10, 9:26 pm, djangomg wrote: > > I am building a cms with page regions, I need to render a dynamic # of > textareas on the admin site and have them combine into a single > database field in the db. Wrong approach IMHO. If you have multiple page regions per page, each needing it's own tex

Piston and foreignkey

2010-02-11 Thread luupux
Hello i have a problem with simple application , but i not understand where is the my error. But I know the problem and is ForeignKey to model listurl because if I use another model without foreigkey everything starts working Excuse my bad English I know the question is stupid but I do not underst

Slow development server

2010-02-11 Thread Benjamin Wolf
Hi, I just set up my local dev server (python 2.6 and django 1.1.1) and it's seems to be very slow. An ajax request what takes online about 0,2 seconds needs more than 2,2 seconds on my dev server. Also when browsing the site it is very slow. It's my first dev server so I can't compare to othe

Re: Customized filter for Django Admin

2010-02-11 Thread Dennis Kaarsemaker
On di, 2010-02-09 at 08:52 +0200, Derek wrote: > Can the filter list for the Region (as shown above in the RegionAdmin > class) be altered in some way such that it only shows those countries > that have regions? i.e. it will not show the complete list of all > Countrys, but only that subset which

Re: Slow development server

2010-02-11 Thread Benjamin Wolf
Hi, I'm sorry, another google search revealed the solution: http://www.thebitguru.com/blog/view/300-Django%20running%20slow%20on%20Windows In short: use 127.0.0.1 instead of localhost and the server runs smooth ;) Am 11.02.2010 11:19

Re: ANN: django-admin-tools 0.1.0 released

2010-02-11 Thread Dennis Kaarsemaker
On wo, 2010-02-10 at 09:56 +0100, David Jean Louis wrote: > I'm happy to announce the availability of the first public release of > django-admin-tools. > > Django-admin-tools is a collection of extensions/tools for the > default > django administration interface, it includes: > * a full featu

Re: Managing different user types

2010-02-11 Thread ALJ
OK ... It was raving a bit there. I didn't actually expect anyone to answer all those questions. On Feb 10, 1:27 pm, ALJ wrote: > I appreciate that this is a very common question. I have searched > through the forums and now totally confused. There seems to be loads > of different methods you

Re: Django Transactions at the Model Level

2010-02-11 Thread Russell Keith-Magee
On Thu, Feb 11, 2010 at 8:55 AM, khoobks wrote: > Hi Everyone, > > I was wondering if a Django guru was able to verify if my mental model > of how django transactions operate is correct. > > The situation that I have is that I'd like to place the > transaction.commit_on_success decorator around a

Dynamic Model

2010-02-11 Thread Sameer Rahmani
is it possible to build a dynamic model in run-time in version 1.1 ? -- lxsameer -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@googlegroups.com. To unsubscribe from this group, send email to

Django on Windows XP with ASE15

2010-02-11 Thread nioz_dm
Is it possible to run django on Windows with ASE15 as a database? I don't see any backend models for ASE and ODBC seems to be deprecated. Is there a work around? -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email t

Installation without root access

2010-02-11 Thread orbital_fox
Is there a way and guides on how to install django without having root access on a system? What are the requirements? With regards, Orbital Fox -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@go

Need help to order a query set

2010-02-11 Thread roomy
Hi... I was wondering if someone could tell me how can I represent this mysql statement in django . "order by first_name='Yash', first_name" -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@go

Re: Installation without root access

2010-02-11 Thread Jonas Obrist
orbital_fox wrote: Is there a way and guides on how to install django without having root access on a system? What are the requirements? With regards, Orbital Fox This is possible but not very nice. I run some sites off a shared hosting. You do need shell access though. Jonas -- You rece

Re: Dynamic Model

2010-02-11 Thread Dennis Kaarsemaker
On do, 2010-02-11 at 15:51 +0330, Sameer Rahmani wrote: > is it possible to build a dynamic model in run-time in version 1.1 ? Not sure if it's possible, but you can try messing around with __new__ from django.db import models.base import ModelBase, Model YourModel = ModelBase.__new__(ModelBase,

Re: Need help to order a query set

2010-02-11 Thread Dennis Kaarsemaker
On do, 2010-02-11 at 03:36 -0800, roomy wrote: > Hi... I was wondering if someone could tell me how can I represent > this mysql statement in django . "order by first_name='Yash', > first_name" http://docs.djangoproject.com/en/dev/ref/models/querysets/#extra-select-none-where-none-params-none-

Re: Sorting multi-level categories

2010-02-11 Thread thefekete
I figured out a work-around to auto-update a sort field on save. You can see the details here: http://thefekete.net/blog/sorting-hierarchical-categories-in-django/ On Jan 16, 3:46 am, Nianbig wrote: > Hi, > > I´m using this code todo a multi-level category > Django-app:http://code.djangoproject

Re: Managing different user types

2010-02-11 Thread Hanne Moa
On 10 February 2010 13:27, ALJ wrote: > 1. The best way to do a simple extension of user information? > As far as I can tell, the best way is to use User Profiles. Ok. I get > that. > - "Storing Additional Information About Users" (http:// > docs.djangoproject.com/en/1.1/topics/auth/#storing-addit

Re: Dynamic Model

2010-02-11 Thread Andy Mikhailenko
Hi Sameer, > is it possible to build a dynamic model in run-time in version 1.1 ? What do you mean by "dynamic"? If you need to define arbitrary attributes in runtime *and* be able to save them correctly in a RDBMS *and* be able to restore the object from the DB *and* be able to query objects by

Re: Can't get Uploaded File into DictReader

2010-02-11 Thread Bill Freeman
The DictReader constructor requires a file like object as it's first argument, not a string. It is also not like open(), so it doesn't take the 'r' argument. You could try: ... reader = csv.DictReader(request.FILES['filename']) ... but you may have to normalize the line endings. I suspe

Re: State of the Django MPTT Art?

2010-02-11 Thread Max Battcher
Jon Loeliger wrote: Folks, I'd like to add a few MPTT manged data-sets to my projects so I am wondering what the current state of the MPTT art is. I'm using Danjgo 1.1.1 right now, and would like to slap down an MPTT manager in my project that is BSD-ish licensed, allows multiple, different sets

Need help storing/retrieving values from a form.MultipleChoiceField

2010-02-11 Thread Kevin Audleman
This must be a fairly common need so I'd love some help figuring out why I've made it so complicated. I've got a CharField "days_available" with choices set to a tuple of weekdays (e.g. Monday, Tuesday, etc.). In my form I am representing this field as a forms.MultipleChoiceField so that multiple

Re: Can't get Uploaded File into DictReader

2010-02-11 Thread bruno desthuilliers
On Feb 11, 4:17 pm, Bill Freeman wrote: > > I suspect that DictReader process the file as an iterator of lines Don't suspect, make sure: http://docs.python.org/library/csv.html#csv.reader """ csvfile can be any object which supports the iterator protocol and returns a string each time its next()

Re: Make a new model outside of models.py

2010-02-11 Thread Bill Freeman
One issue is that for syncdb to work it has to find all of the models. It does this, IIUC, by importing models from each INSTALLED_APP. If you can arrange for that to import your added model, you are on the right track. For example, you can make your models.py files each import an extra file con

Re: csrf error on login and admin

2010-02-11 Thread Nixarn
Ok. Just so anyone browsing this later. The weird timeout error was just a stupid javascript bug. And I blamed tornado first, then after giving fastcgi a shot and still getting the error I blamed nginx. Then after trying apache2 + wsgi and still getting the same timeout I blamed linode. Then after

Re: Need help storing/retrieving values from a form.MultipleChoiceField

2010-02-11 Thread Bill Freeman
It's probably a little more complex than that. When you want to display the current DB value in a form for editing, you're going to have to turn it back into a list. If I recall correctly, there is a field on djangosnippets that implements storing a multi-select as comma separated values. I don'

Re: Setting from address for internally generated emails

2010-02-11 Thread Nick Booker
Thank you, that has worked. On 10/02/10 15:11, Karen Tracey wrote: On Wed, Feb 10, 2010 at 10:01 AM, Nick Booker mailto:n...@clocksoft.com>> wrote: Sorry I correct myself -- I meant it always has a from address of r...@localhost, which the customer's relay rejects. SERVER_EMAIL is the

Re: Can't get Uploaded File into DictReader

2010-02-11 Thread bruno desthuilliers
On Feb 10, 2:50 am, jeff wrote: > I'm trying to upload a CSV file specified by the user in a form and > then parse it using DictReader.  Everything seems to be working until > I initialize DictReader with the uploaded file.  As soon as I try to > access any value in the row, it throws an odd exc

How to set an Admin form field value before displaying the form?

2010-02-11 Thread Derek
I like to set the value/s of a field in a form before displaying it. A rather silly example (to illustrate the principle) : class King(models.Model): name = models.CharField(max_length=250, blank=False) class KingModelForm ( forms.ModelForm ): first = forms.CharField( label = 'Foo', req

Django Template System with no Django instalation

2010-02-11 Thread Gerson Goulart
Is it possible to have the Django Template System running straight over Apache without the need of the whole Django Framework instaled, let's say, to make it possible to use this template system with other systems made in other languages such Java, just using this TPL system process the output in A

Re: How to set an Admin form field value before displaying the form?

2010-02-11 Thread Nick Booker
The way to do that is to use the 'initial' keyword argument when you instantiate the form, to which you supply a dictionary of field name : initial value e.g.: form = KingModelForm(initial={'first': 'First Name', 'last': 'Surname'}) How you split the name will depend on how you're storing it.

error check for start,end datetimes in model and form

2010-02-11 Thread harryos
hi I have an entry model and its modelform .The entry model has a start,end datetimes.I want to prevent the user from mistakenly entering an end datetime value which is before the start datetime.(ie, end=11feb2010 and start=12feb2010 is wrong).I tried to do the error check in an add_entry() view. I

error check for start ,end datetime values in view

2010-02-11 Thread harryos
hi I have an entry model and its modelform .The entry model has a start,end datetimes.I want to prevent the user from mistakenly entering an end datetime value which is before the start datetime.(ie, end=11feb2010 and start=12feb2010 is wrong).I tried to do the error check in an add_entry() view. I

Images, videos and thumbnails.

2010-02-11 Thread Nasp
Hey guys, I just did the big switch from PHP and I'm wondering if you can help me solve this issue the django way. The big picture is, we've got news associated with images and videos. Those "medias" can be ordered and must provide thumbnails for the client side. So far i came up with inline orde

Django v1.1.0 v1.1.1?

2010-02-11 Thread Cheet
Hello, Any one know the diffs between these versions? http://docs.djangoproject.com/en/1.1/releases/#releases-index this page does not have any information of v1.1.0 Mine is running 1.1.0 final: >>> import django >>> django.VERSION (1, 1, 0, 'final', 0) Thanks very much! -- You received

Re: Django v1.1.0 v1.1.1?

2010-02-11 Thread Gabriel .
On Thu, Feb 11, 2010 at 2:23 PM, Cheet wrote: > Hello, > > Any one know the diffs between these versions? > http://docs.djangoproject.com/en/1.1/releases/#releases-index this > page does not have any information of v1.1.0 > > Mine is running 1.1.0 final: > http://www.djangoproject.com/weblog/

django-multilingual NotImplementedError

2010-02-11 Thread crsantos
Hi: Anyone having troubles with latest version of django-multilingual? I just added a translation class to my model as this: class Post(models.Model): class Translation (multilingual.Translation): title = models.CharField(max_length=200) body = models.Tex

Re: Django v1.1.0 v1.1.1?

2010-02-11 Thread Karen Tracey
On Thu, Feb 11, 2010 at 12:28 PM, Gabriel . wrote: > On Thu, Feb 11, 2010 at 2:23 PM, Cheet wrote: > > Hello, > > > > Any one know the diffs between these versions? > > http://docs.djangoproject.com/en/1.1/releases/#releases-index this > > page does not have any information of v1.1.0 > > > >

Expiring view caches

2010-02-11 Thread HARRY POTTRER
Is there any way to manually expire per-view caches? I have a view that executes between 100 and 200 database queries to render the page. The page basically renders a stats page for each user on my site. It only takes a few hundred milliseconds, but none the less I want some kind of cache sitting

Re: Expiring view caches

2010-02-11 Thread David Zhou
Check out this snippet: http://www.djangosnippets.org/snippets/936/ Some what old though (2008), so it might need updating to work properly. -- dz On Thu, Feb 11, 2010 at 4:18 PM, HARRY POTTRER wrote: > Is there any way to manually expire per-view caches? > > I have a view that executes betw

debugging server code problems in server code that is invoked via ajax request

2010-02-11 Thread Margie Roginski
I have a question about debugging django server side code in the case where the request is an ajax request. For example I have an autocomplete widget. It makes a request to a particular url that takes me to one of my views.py functions, get_users(request). If I have some sort of error in that fu

Re: Expiring view caches

2010-02-11 Thread HARRY POTTRER
Oh I see, the key is an entire request object. Thanks, that worked! On Feb 11, 4:22 pm, David Zhou wrote: > Check out this snippet: > > http://www.djangosnippets.org/snippets/936/ > > Some what old though (2008), so it might need updating to work properly. > > -- dz > > On Thu, Feb 11, 2010 at 4:

Re: debugging server code problems in server code that is invoked via ajax request

2010-02-11 Thread Javier Guerra
On Thu, Feb 11, 2010 at 4:27 PM, Margie Roginski wrote: > In the case of an ajax request, what happens to the error > from the server code and is there any way to see it? i use firebug. it lets you see every http interaction. with contents and all. unfortunately, it doesn't render HTML response

Re: debugging server code problems in server code that is invoked via ajax request

2010-02-11 Thread Javier Guerra
On Thu, Feb 11, 2010 at 4:31 PM, Javier Guerra wrote: > unfortunately, it doesn't render HTML responses... i'm glad to report i was wrong! it _does_ render content as HTML on a new tab. -- Javier -- You received this message because you are subscribed to the Google Groups "Django users" gr

Re: Make a new model outside of models.py

2010-02-11 Thread iliveinapark
In the model's meta class, give it a field app_label, eg: class MyModel(models.Model): ... class Meta: app_label = "myapp" I use this to split my models into multiple files in a models subdirectory of my app. Adding a __init__.py with from modelfile import * for each model file m

Re: Expiring view caches

2010-02-11 Thread HARRY POTTRER
just a quick note to anyone out there who finds this thread with the same problem as me: in that snippet, you need to change this line: if cache.has_key(key): to this: if key and cache.has_key(key): in order for it to work. It seems that registering accounts on django- snippets is broken, so p

Re: having an ManyToMany field, and have it optional

2010-02-11 Thread iliveinapark
I guess you're correct Atamert, though I'm sure this is still the case for ForeignKey fields, isn't it? On Feb 11, 8:16 pm, Atamert Ölçgen wrote: > On Thursday 11 February 2010 08:26:10 iliveinapark wrote:> Both are required > for a ForeignKey or ManyToManyField to be empty, ie: > > > class Goal

Re: error check for start ,end datetime values in view

2010-02-11 Thread Daniel Roseman
On Feb 11, 5:03 pm, harryos wrote: > hi > I have an entry model and its modelform .The entry model has a > start,end datetimes.I want to prevent the user from mistakenly > entering an end datetime value which is before the start datetime.(ie, > end=11feb2010 and start=12feb2010 is wrong).I tried t

Object data change approvals.

2010-02-11 Thread iliveinapark
Gday all, I'm trying to find a way to have changes made to a model object require approval before becoming the live data on my site. I had thought about cloning the object, and having the clone stored as a draft, but making it live would require either swapping all the data from the draft to the o

django-mptt TreeNodeChoiceField

2010-02-11 Thread geraldcor
Sorry to ask such a seemingly silly question, but how do I use TreeNodeChoiceField in a ModelForm. To create a new node, I created a ModelForm, and, like other ModelForms, I thought I could just override the normal form widget. Here are my classes class Folder(models.Model): parent = model

Re: Django Template System with no Django instalation

2010-02-11 Thread creecode
Hello Gerson, This might give you a starting point < http://docs.djangoproject.com/en/dev/ref/templates/api/#configuring-the-template-system-in-standalone-mode>. On Feb 11, 8:43 am, Gerson Goulart wrote: > Is it possible to have the Django Template System running straight > over Apache without t

Re: Installation without root access

2010-02-11 Thread Sam Lai
On 11 February 2010 21:32, orbital_fox wrote: > Is there a way and guides on how to install django without having root > access on a system? What are the requirements? The easiest way I think is to use virtualenv, which creates a virtual python environment in a directory that you have write acces

Re: Installation without root access

2010-02-11 Thread James Bennett
On Thu, Feb 11, 2010 at 4:32 AM, orbital_fox wrote: > Is there a way and guides on how to install django without having root > access on a system? What are the requirements? The single most useful thing you're going to be able to do for yourself is go work through the standard Python tutorial, sp

Re: Django Template System with no Django instalation

2010-02-11 Thread Matías Iturburu
On Thu, Feb 11, 2010 at 9:35 PM, creecode wrote: > Hello Gerson, > > This might give you a starting point < > > http://docs.djangoproject.com/en/dev/ref/templates/api/#configuring-the-template-system-in-standalone-mode > >. > There is no clean way to use the template language without django (you

Generic Many-To-Many without GenericRelations

2010-02-11 Thread ben
Generic Many-To-Many Relationships I have a collection class which contains arbitrary objects using a Generic Many-To-Many relationship. class Collection(models.Model): name = models.CharField(max_length=VERBOSE_NAME_MAX_LENGTH) def member_objects(self, klass): """Returns a Quer

Problem while creating database tables through the models.

2010-02-11 Thread Newbie
Dear all, Downloaded and followed the steps which is given in the documentation of Django Created the project called mysite Created the model called polls Ratified the settings.py of the project to create a model as a table in the database using INSTALLED_ A

Re: how to redirect to another page in if else condition.

2010-02-11 Thread dj_vishal
Django Provides in Built authetication API http://docs.djangoproject.com/en/1.1/topics/auth/#topics-auth Read it simply You can understand -- View this message in context: http://old.nabble.com/how-to-redirect-to-another-page-in-if-else-condition.-tp27526236p27558793.html Sent from the django-

Re: Problem while creating database tables through the models.

2010-02-11 Thread Shawn Milochik
Try changing the database to sqlite3 and see if it works. If so, you know the problem is with Postgres. If not, it's probably something you did. Also, Postges 7.4 is way out of date -- the current is 8.4. It could be that the psycopg2 interface has a problem with a version that old. Shawn --

Mailing list app

2010-02-11 Thread Vitaly Babiy
Hey guys, Has any found a good application to send emails to your users? Like you want to let all your user know of downtime. Thanks Vitaly Babiy -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...

Re: Problem while creating database tables through the models.

2010-02-11 Thread Christophe Pettus
On Feb 11, 2010, at 8:38 PM, Newbie wrote: NOTE : Django version is 1.1.1 and PostgreSQL version is 7.4.16 Is there is a reason you are using such an old version of PostgreSQL? -- -- Christophe Pettus x...@thebuild.com -- You received this message because you are subscribed to the Google

"current transition aborted" not sure if this is a bug

2010-02-11 Thread paul
hello -- just let me know if my description below sounds like a bug. If so, I can try to put together a decent bug report... I am working on fleshing out the integration of a custom authentication backend. Basically I have a OpenLDAP directory that is used to store user names and passwords (in c

Re: django-debug-toolbar and 404's

2010-02-11 Thread Rishabh Manocha
On Thu, Feb 11, 2010 at 11:56 AM, Mike Dewhirst wrote: > Rishab > > Maybe you haven't included any toolbar panels? > > Here is an example ... > > if TOOLBAR: >DEBUG_TOOLBAR_CONFIG = { >'INTERCEPT_REDIRECTS': TOOLBAR_REDIRECTS, >'SHOW_TOOLBAR_CALLBACK': None, >} > >DEBUG