Re: DateField issues

2010-06-16 Thread Alexander Jeliuc
Here is DateField class I think You will find all You need here class DateField(Field): description = _("Date (without time)") empty_strings_allowed = False default_error_messages = { 'invalid': _('Enter a valid date in -MM-DD format.'), 'invalid_date':

Re: DateField issues

2010-06-16 Thread Alexander Jeliuc
Your error is this... def save(self,*args,**kwargs): if not self.start_date: self.start_date=models.DateField(datetime.date.today()) year=timedelta(days=365) self.expire_date=models.DateField(datetime.date.today() +year) On Thu, Jun 17, 2010 at 8:40 AM,

Re: DateField issues

2010-06-16 Thread Sheena
Thanks The question is how do I populate a field with some other date, for example, there's a date of birth field that the auto stuff wont be ideal for... In the populate method i mentioned before, i passed the dob(date of birth) field a Date object initialized to something arbitrary. Does the

Re: DateField issues

2010-06-16 Thread Alexander Jeliuc
read about autofill_now=True and autofill=True On Thu, Jun 17, 2010 at 8:14 AM, Sheena wrote: > I've defined a number of models, one of which I've called > MemberProfile that looks like this > > class MemberProfile(models.Model): >

DateField issues

2010-06-16 Thread Sheena
I've defined a number of models, one of which I've called MemberProfile that looks like this class MemberProfile(models.Model): postal_addr1=models.CharField(max_length=50, verbose_name="postal address line 1") postal_addr2=models.CharField(max_length=50, verbose_name="postal address line

Re: URLConf

2010-06-16 Thread Rolando Espinoza La Fuente
On Wed, Jun 16, 2010 at 11:48 PM, Siddharth. S wrote: > Hi, > > I did the following to allow the page to be loaded with or without the > '/' at the end: > > (r'^mysite(/*)$', redirect_to, {'url':'/mysite/home/'}), > > in URL patterns. I got an error page, and the following

Re: Selling Django

2010-06-16 Thread Venkatraman S
On Wed, Jun 16, 2010 at 9:56 PM, finn wrote: > I think that we - the Django community - could do a better job selling > our product, and I'd like to volunteer in this work. I just don't know > how to do it. > Very well structured email - and i concur to the views

Re: key error in templates - solved

2010-06-16 Thread Kenneth Gonsalves
On Thursday 17 June 2010 10:02:20 Venkatraman S wrote: > > Once I repickled, the problem was solved > > Totally not related to your Q, but if you are using photos - try using > django-photologue. Its awsum! > was awesome - I do not think it is maintained now, I tried it with trunk and gave up

Re: key error in templates - solved

2010-06-16 Thread Venkatraman S
On Thu, Jun 17, 2010 at 9:58 AM, Kenneth Gonsalves wrote: > solved - what had happened was that when I pickled the results, the model > in > question did not have a 'photo' field which I added subsequently to > pickling. > Once I repickled, the problem was solved > Totally

Re: key error in templates - solved

2010-06-16 Thread Kenneth Gonsalves
On Thursday 17 June 2010 06:46:21 Kenneth Gonsalves wrote: > In my current project I am getting keyerror: photo where the photo does > not exist. This is running on latest trunk. The only difference between > the two sites is that in site where it is working, 'p' is a query set > passed from

Re: OneToOneField usage

2010-06-16 Thread bob84123
> Is there a particular reason why using a related OneToOneField raises > DoesNotExist instead of returning None? > > | class Person( Model ): > |    pass > | > | class Pet( Model ): > |    owner = OneToOneField( Person ) > | > | # Assuming "joe" exists as a Person > | >>> kitty = joe.pet > |

URLConf

2010-06-16 Thread Siddharth. S
Hi, I did the following to allow the page to be loaded with or without the '/' at the end: (r'^mysite(/*)$', redirect_to, {'url':'/mysite/home/'}), in URL patterns. I got an error page, and the following error: Exception Type: TypeError at /mysite/ Exception Value: redirect_to() got multiple

admin filters getting reset after admin action

2010-06-16 Thread rahul jain
Hi there, I have some filters set-up on admin page. As soon as I perform admin action. All filters are getting reset. Is this is a bug from framework ? --RJ -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to

Form Relationships, Multiple Models Using a loop?

2010-06-16 Thread Erich
First time poster, so go easy on me... I need to create a form that will display a heading / description that comes from one model (DReq) which I can get to display in a for loop. Each dreq.desc is dependent on the results of a var that gets set and read in from the user's session. Then I need to

Re: key error in templates

2010-06-16 Thread Kenneth Gonsalves
On Thursday 17 June 2010 06:46:21 Kenneth Gonsalves wrote: > in many models with an imagefield called photo, I have this code in the > template: > > {% if p.photo %} > > > {% endif %} > > this has been working across many sites for years - and is working on a >

key error in templates

2010-06-16 Thread Kenneth Gonsalves
hi, in many models with an imagefield called photo, I have this code in the template: {% if p.photo %} {% endif %} this has been working across many sites for years - and is working on a particular site running Revision: 12453. In my current project I am getting

Clean method across multiple models?

2010-06-16 Thread JHeasly
Hello all, Is there a sane way to make a clean [1] method that depends on fields from across multiple models? I've got a view that uses two form classes and want to write custom validation that checks clean_data fields in both models and I'm looking for an example of such. TIA, John [1]

Re: Selling Django

2010-06-16 Thread Kenneth Gonsalves
On Wednesday 16 June 2010 21:56:12 finn wrote: > I think that we - the Django community - could do a better job selling > our product, and I'd like to volunteer in this work. I just don't know > how to do it. > which is your market? The CMS market is aimed at the end user - the django market is

Re: I experience problem with special chars like æ øå in filename when using models.ImageField. and models.Fi leField

2010-06-16 Thread MichaelHjulskov
You are totally right Karen This solved the problem, just as you said it would: export LANG='en_US.UTF-8' export LC_ALL='en_US.UTF-8' Thanks alot Karen :o) So now I only need to: Fix the security issue to make sure that people dont upload php files etc. (I just read a warning about that) And if

Re: Why does django's default test suite runner set settings.DEBUG = False?

2010-06-16 Thread Russell Keith-Magee
On Thu, Jun 17, 2010 at 5:40 AM, Peter Bengtsson wrote: > This is a new feature of Django 1.2. I'm curious, why does it want to > do this? I want to control this for my settings so that I can things > like disabled verify_exists on my URLFields when I run tests. No, it isn't a

Re: select_related removes broken Foreign Keys, but How?

2010-06-16 Thread Russell Keith-Magee
On Wed, Jun 16, 2010 at 11:55 PM, ryan wrote: > I noticed this first in the Django Admin.  If you have 100 rows in > Table A, and 5 of those have a foreign key entry pointing to a > nonexistent item in Table B, rather than throwing an error, the admin > displays 95. This

Re: i18n variable string translation

2010-06-16 Thread Aaron Lee
Another problem I am facing is it seems some pages are not being translated until I hit certain page, after that everything is fine. I am not exactly sure what the problem is but if you guys experience this problem, would appreciate some insights. -Aaron On Wed, Jun 16, 2010 at 4:47 PM, Aaron

Re: i18n variable string translation

2010-06-16 Thread Aaron Lee
Thanks, the lazy translation solves the problem. -Aaron On Wed, Jun 16, 2010 at 2:59 PM, Antoni Aloy wrote: > Try to use lazy translation. > > El 16/06/2010 23:09, "Aaron" escribió: > > > Well what happened was I have a forms.py > > which has > >

Re: Multiple AJAX sends within a views.py-function

2010-06-16 Thread Christoph Siedentop
Hi Ian, On Wed, Jun 16, 2010 at 4:11 PM, Ian McDowall wrote: > Cool. That is a clever way to subvert (I don't mean this negatively) > the response generation.  I do have a couple of comments: :-) Thanks > 1) It relies on the response being sent to the client as it is >

Re: How to implement this model

2010-06-16 Thread Nick
The question is how do I relate this to the business_types in the FulLProfile model? Since a business can have multiple "Premises" On Jun 16, 4:44 pm, Peter Bengtsson wrote: > Without caring or even attempting to understand your business I sounds > like you just need to stop

Re: i18n variable string translation

2010-06-16 Thread Antoni Aloy
Try to use lazy translation. El 16/06/2010 23:09, "Aaron" escribió: Well what happened was I have a forms.py which has CONSTANT = _("Hello World") x = {'var': CONSTANT } and in the django.po, I do have a translation msgid "Hello World" msgstr "xxx" But it doesn't show

Re: How to implement this model

2010-06-16 Thread Peter Bengtsson
Without caring or even attempting to understand your business I sounds like you just need to stop using a BooleanField() and instead use a ForeignKey(null=True) and then judge if it's "on_premise" by a method rather than a field something like this: class MyModel(Model): related_premise =

Why does django's default test suite runner set settings.DEBUG = False?

2010-06-16 Thread Peter Bengtsson
This is a new feature of Django 1.2. I'm curious, why does it want to do this? I want to control this for my settings so that I can things like disabled verify_exists on my URLFields when I run tests. # django/test/simple.py class DjangoTestSuiteRunner(object): def __init__(self,

Re: How to implement this model

2010-06-16 Thread Nick
I am going to try to add better information for this issue, here we go: The model for the obituary looks like this: class obit_entry(models.Model): first_name = models.CharField('First Name', max_length=100, blank=False) middle_name = models.CharField('Middle Name', max_length=100,

Re: Q objects for subqueries with cross-references

2010-06-16 Thread akaariai
On 16 kesä, 21:41, rt wrote: > Hi, > >  I am having a hard time with Q objects based on subqueries. It's a > part of a linguistic corpus analysis query builder (hence Q objects as > this is how I parse and translate arbitrary queries into Django) -- > the user can search

Re: models.URLField with verify_exists=True pass non existent Urls to DB

2010-06-16 Thread aurel...@gmail.com
Thanks Karen! Django 1.0 Web Site Development book (code example is from that book) has following paragraph: "By specifying correct field types in our form, we don't have to implement any additional input validation. For example, Django will automatically make sure that the user enters a valid

Re: i18n variable string translation

2010-06-16 Thread Aaron
Well what happened was I have a forms.py which has CONSTANT = _("Hello World") x = {'var': CONSTANT } and in the django.po, I do have a translation msgid "Hello World" msgstr "xxx" But it doesn't show up on the website, all the other translations work, so I am wondering what am I missing

Re: Is it possible to use Django with an API as its back-end?

2010-06-16 Thread Douglas Graves
Erik, thanks so much for pointing me to django-roa. It looks really cool, particularly because of its ability to handle so many different types of data storage solutions (eg - nosql, multiple dbs, etc). I also randomly stumbled across django-pipes, which seems to work really well for running

Re: How to create the model in a different database from within the same database server.

2010-06-16 Thread thusjanthan
Django 1.2 I have the following setup: ProjectA settings.py: ... DATABASES = { 'default': { 'ENGINE': 'django.db.backends.mysql', # Add 'postgresql_psycopg2', 'postgresql', 'mysql', 'sqlite3' or 'oracle'. 'NAME': 'test_database', # Or path to database

Re: i18n variable string translation

2010-06-16 Thread Baurzhan Ismagulov
On Wed, Jun 16, 2010 at 01:00:36PM -0700, Aaron Lee wrote: > def my_view(request): > sentence = 'Welcome to my site.' > output = _(sentence) > return HttpResponse(output) > > (The caveat with using variables or computed values, as in the previous two > examples, is that Django’s

i18n variable string translation

2010-06-16 Thread Aaron Lee
Hi guys, In http://www.djangobook.com/en/2.0/chapter19, there is a paragraph Translation works on variables. Again, here’s an identical example: def my_view(request): sentence = 'Welcome to my site.' output = _(sentence) return HttpResponse(output) (The caveat with using variables

Re: how to use render_to_response, ajax and javascript variables

2010-06-16 Thread Alex
Thanks all. I may go with Matt's idea of serialising html + other data to json and decoding client side. I'm not totally keen though because this abandons a very nice rollup of functionality in django's render_to_response (I am not familiar with how to write the template as JSON and rendering to

Re: How to create the model in a different database from within the same database server.

2010-06-16 Thread Nick
Which version of django are you working with? On Jun 16, 2:28 pm, thusjanthan wrote: > Hi, > > when I mean database I mean the separate databases from within one > mysql database server. So ex: > > DB server: server.example.com > Databases that are contained in the one

How to implement this model

2010-06-16 Thread Nick
OK, here's the deal. I'm working up an obituary site. There are 3 models/tables and at one point I need to connect two in a way that is different than I have done up to this point. Here is the situation, any recommendations on how to accomplish this would be great: I have an obituary table. In

Re: Seeking Django vs. Joomla comparison

2010-06-16 Thread Hooshyar
Many thanks to V and others who have contributed to this topic. More info. I guess I am coming up to speed now. The decision makers are not managers, but a private organization who members will read both proposals and ask questions from both vendors. At then end they vote democratically. One

Re: custom template tags with a raw query

2010-06-16 Thread Cole743
The first link I had seen and used. My custom query works, I had just been having issues with the tags. I had been through the docs and seen a different one on tags, but apparently passed over the one you posted in the link. It filled in some of the gaps I was missing, thanks. Very helpful. --

Q objects for subqueries with cross-references

2010-06-16 Thread rt
Hi, I am having a hard time with Q objects based on subqueries. It's a part of a linguistic corpus analysis query builder (hence Q objects as this is how I parse and translate arbitrary queries into Django) -- the user can search 'posts' that meet complex criteria. Anyway, it's all working fine

Re: enumerating view functions

2010-06-16 Thread Alexis Roda
En/na Dmitry Beransky ha escrit: Hi, Is there a way to enumerate view functions that are currently associated with a url patern? In the end, I'd like to get a list of triples: pattern name, pattern, callback function. If you want to get a dump of the (regex, view, name) triples on the

Re: Seeking Django vs. Joomla comparison

2010-06-16 Thread VWAllen
> A little background. I am a Django developer for almost 4 years. > Recently I submitted a proposal to undertake the web operation of a > community run orgnization. One vendor proposed Joomla and I have > proposed Django. Never mind, he says Joomla is a framework. That is > OK. What primarily

Re: Is there any kind of verbose_name for apps?

2010-06-16 Thread patrickk
I don´t think there is (although this issue has already been discussed years ago) - no ability to change apps-name and/or app-translations. you could use a 3rd-party-app like admin-tools to customize your index- page and change appnames (see

enumerating view functions

2010-06-16 Thread Dmitry Beransky
Hi, Is there a way to enumerate view functions that are currently associated with a url patern? In the end, I'd like to get a list of triples: pattern name, pattern, callback function. Thanks Dmitry -- You received this message because you are subscribed to the Google Groups "Django users"

Re: models.URLField with verify_exists=True pass non existent Urls to DB

2010-06-16 Thread Karen Tracey
On Wed, Jun 16, 2010 at 1:29 PM, aurel...@gmail.com wrote: > Hi, > > I have a model with URLField. Parmether verify_exists is set to True, > but when I enter url that does not exists (e.g. http://foobarbarfoo.com, > or http://www.google.com/foobar) they somehow manage to get

models.URLField with verify_exists=True pass non existent Urls to DB

2010-06-16 Thread aurel...@gmail.com
Hi, I have a model with URLField. Parmether verify_exists is set to True, but when I enter url that does not exists (e.g. http://foobarbarfoo.com, or http://www.google.com/foobar) they somehow manage to get to the DB. Should model report error? Or I do not understand docs: "If True (the

Re: Problem in Django App Part 1 Tutorial

2010-06-16 Thread !...@!!!
PO On Jun 16, 6:55 pm, "!...@!!!" wrote: > P > > On Jun 16, 6:49 pm, "!...@!!!" wrote: > > > > > Thanks Thierry, but problem solved!...:) -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to

Re: Selling Django

2010-06-16 Thread Tom Evans
On Wed, Jun 16, 2010 at 5:26 PM, finn wrote: > Hi, > > I have with interest followed the thread "Seeking Django vs. Joomla > comparison", and it has inspired me to start this new thread. > > > > Let me end this post with a comment to the "compare-apples-with- >

Re: Problem in Django App Part 1 Tutorial

2010-06-16 Thread !...@!!!
P On Jun 16, 6:49 pm, "!...@!!!" wrote: > Thanks Thierry, but problem solved!...:) -- 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

Re: Problem in Django App Part 1 Tutorial

2010-06-16 Thread !...@!!!
Thanks Thierry, but problem solved!...:) -- 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

File - .dat

2010-06-16 Thread Waleria
Hello, I need to leave a file tabbed, like this: http://www.srl.caltech.edu/~shane/sensitivity/asteroids/scg_8564.dat Following piece of my code that does this: - with Django # - # Import # - from django.shortcuts import

Selling Django

2010-06-16 Thread finn
Hi, I have with interest followed the thread "Seeking Django vs. Joomla comparison", and it has inspired me to start this new thread. I consider myself a Python/Django programmer, and I do so because my experiences with a number of programming languages, CMS'es and web frameworks has lead me to

Django access data passed to form

2010-06-16 Thread Lukáš
Hey, I have got a choiceField in my form, where I display filtered data. To filter the data I need two arguments. The first one is not a problem, because I can take it directly from an object, but the second one is dynamically generated. Here is some code: class GroupAdd(forms.Form): def

select_related removes broken Foreign Keys, but How?

2010-06-16 Thread ryan
I noticed this first in the Django Admin. If you have 100 rows in Table A, and 5 of those have a foreign key entry pointing to a nonexistent item in Table B, rather than throwing an error, the admin displays 95. This happens if you set list_select_related = True, or if one of the list_display

admin actions

2010-06-16 Thread rahul jain
Hi, I would like to display javascript alert boxes when something goes wrong during admin actions. Is it possible ? --RJ -- 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

Re: Seeking Django vs. Joomla comparison

2010-06-16 Thread Hooshyar
Thank you all for your thoughts. I liked the link to article that compares Drupal with Django. I wish there was a Joomla vs. Drupal compariosn too. A little background. I am a Django developer for almost 4 years. Recently I submitted a proposal to undertake the web operation of a community run

Cannot import a module when deployed in Apache WSGI

2010-06-16 Thread Radhakrishna
This may be very silly, but I cant figure out the problem. Everything seems to be in place. I have deployed my django project to Apache using mod_wsgi. In urls.py I am mapping "gateway/" to gateway.py which imports 'pyamf' module. The problem is, even though pyamf module is in python path, its not

Re: Multiple AJAX sends within a views.py-function

2010-06-16 Thread Ian McDowall
Cool. That is a clever way to subvert (I don't mean this negatively) the response generation. I do have a couple of comments: 1) It relies on the response being sent to the client as it is generated and not buffered by the server. That is clearly working for you and I don't know the internals

Re: how to use render_to_response, ajax and javascript variables

2010-06-16 Thread Ian McDowall
Just one comment - Django lets you render to JSON just as easily as rendering to HTML (or XML). You just write your template as JSON and set the MIME type for the response accordingly. Because I control my JSON parsing on the client side, I set the MIME type to text/plain but you could set to

Re: mod_wsgi sometimes gives error on first reload but not thereafter

2010-06-16 Thread Matt Hoskins
On Jun 16, 3:07 pm, Chris Seberino wrote: > On Jun 15, 6:42 pm, Graham Dumpleton > wrote: > > > This occurs when Apache is first reading HTTP headers for request and > > long before it hands it off to any Django application or even > > mod_wsgi.

In a view how do I obtain the sessionid which will be part of the Set-Cookie header of following response ?

2010-06-16 Thread Rohit
In case of views that contain login or logout, this sessionid is different from the one submitted in request's Coockie header. I need to retrieve it before returning response for some purpose. I need to retrieve it between 'login(...)' and 'return HttpResponse(...)' How can I do this ? Django

Re: modeling a book repository

2010-06-16 Thread Tim Arnold
One more reply after doing some more research. Apparently this has been discussed quite a bit and a solution may appear in the 1.3 release: http://code.djangoproject.com/ticket/7539 But, to handle the situation where you want to avoid a cascade delete (which was my problem with my previous/next

Is there any kind of verbose_name for apps?

2010-06-16 Thread Massimiliano della Rovere
And if not how can I emulate that? -- 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-users+unsubscr...@googlegroups.com. For

Re: Problem in Django App Part 1 Tutorial

2010-06-16 Thread Thierry
I noticed you are importing your project name, are you invoking your "python manage.py shell" from within your project folder? If you are, try the following: project_folder/python manage.py shell >>> from polls.models import Poll >>> dir(Poll) The above should show you that

Re: Problem in Django App Part 1 Tutorial

2010-06-16 Thread !...@!!!
Never mind I solved the problem! For all of you with the same problem: it appears that the first time that you use or import (i'm not really sure) a class in the python shell, it's source-code file is compiled automatically in a ".pyc" file, in the same directory where the source-code file is

Re: Problem in Django App Part 1 Tutorial

2010-06-16 Thread !...@!!!
Never mind I solved the problem! For all of you with the same problem: it appears that the first time that you use or import (i'm not really sure) a class in the python shell, it's source-code file is compiled automatically in a ".pyc" file, in the same directory where the source-code file is

Re: mod_wsgi sometimes gives error on first reload but not thereafter

2010-06-16 Thread Chris Seberino
On Jun 15, 6:42 pm, Graham Dumpleton wrote: > This occurs when Apache is first reading HTTP headers for request and > long before it hands it off to any Django application or even > mod_wsgi. Is there anything I can do about this? I assume this means we should

Re: determining changes in file

2010-06-16 Thread Gonzalo Delgado
El 16/06/10 03:56, tazimk escribió: > I have a text file being written by another process on a server which > I want to watch for changes. Each time a change occurs I'd like to > read the new data and send it to client . Any suggestions will be > valuable . Using Django,Python > If using Linux,

Re: how to use render_to_response, ajax and javascript variables

2010-06-16 Thread Matt Hoskins
Perhaps instead of using render_to_response to generate the response, render the template output to a string and then stuff that in the data structure that you serialise to json along with the other data? Regards, Matt On Jun 16, 1:17 pm, Alex wrote: > > But the

Re: how to use render_to_response, ajax and javascript variables

2010-06-16 Thread Tom Evans
On Wed, Jun 16, 2010 at 1:17 PM, Alex wrote: > Hi, > > Please can anyone help with an app architecture problem I am having? > (I am quite new to Django) > > I have an app which which serves up XHR requests (via YUI3 io > uitility) to urlpatterns.  The views make

how to use render_to_response, ajax and javascript variables

2010-06-16 Thread Alex
Hi, Please can anyone help with an app architecture problem I am having? (I am quite new to Django) I have an app which which serves up XHR requests (via YUI3 io uitility) to urlpatterns. The views make HttpResponses using render_to_response like so: return

Problem in Django App Part 1 Tutorial

2010-06-16 Thread !...@!!!
Hello, I am a Python newbie and this is my first time I use Django and Python. I was reading the Django App tutorial Part 1 and got stuck in a place. I execute these statements in the Python Shell: >>> from mysite.polls.models import Poll, Choice >>> import datetime >>> p = Poll(question="What's

Re: Overriding fForm class __init__ method

2010-06-16 Thread DevelopsDjangoApps
Thanks a lot. Your solution was the right one. However, I just needed to provide 'pid' as the only argument for the pop method. Now when I use the following command in my view it doesn't give me any error: form = VoteRadioForm(request.POST, pid = 2 ) However, I'm having a problem with form

Re: Emailing users with invalid local part email addresses

2010-06-16 Thread Dennis Kaarsemaker
On di, 2010-06-15 at 17:44 +0100, Tom Evans wrote: > I have a bunch of users from one of our subscribers who all have > invalid local parts to their email addresses. > > Eg: > > åsak.østerga...@example.com > jan-åke.hammarstr...@example.com > > Django assumes that all the addresses are valid,

Re: Overriding fForm class __init__ method

2010-06-16 Thread Daniel Roseman
On Jun 16, 10:30 am, DevelopsDjangoApps wrote: > Hi, > > I have created a form class like this: > > class VoteRadioForm(forms.Form): > >     choices = > forms.ModelChoiceField(queryset=Choice.objects.filter(poll__active= > True, poll__id = 2), >                                

Overriding fForm class __init__ method

2010-06-16 Thread DevelopsDjangoApps
Hi, I have created a form class like this: class VoteRadioForm(forms.Form): choices = forms.ModelChoiceField(queryset=Choice.objects.filter(poll__active= True, poll__id = 2), empty_label= None, widget= forms.RadioSelect, )

Re: commit=False in Model save?

2010-06-16 Thread Heleen
Today I'm a bit more awake than when I replied yesterday and I realized that you're talking about views here. What I mean however is that I would like to do validation in the model class' save function in models.py. I have tried to use this method on my save function though, but it just gives me

Model validation (not form validation)

2010-06-16 Thread MH
Hi, I'm making a model, that has a bit complex dependencies between the fields, such as date progression (start_date must not be later than finish_date). I'm looking for a way to validate these dependencies while creating (or saving) the model, but I am not sure which approach should I use. The

Re: Multi-db: is database routing per request possible?

2010-06-16 Thread johan de taeye
Russ, Your gut feeling confirms my suspicion. Changing the lines to the following fixes my problem: db = model_instance._state.db if db is None: db = router.db_for_write(model_instance.__class__, instance=model_instance) qs =

determining changes in file

2010-06-16 Thread tazimk
Hi, I have a text file being written by another process on a server which I want to watch for changes. Each time a change occurs I'd like to read the new data and send it to client . Any suggestions will be valuable . Using Django,Python Tazim. -- You received this message because you are