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': _('Invalid
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, Sh
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 Dat
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):
>postal_addr1=models.CharField(max_length=50, verbose_name="po
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
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 error:
>
> Exception Typ
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 expressed and i
myself am someti
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 a
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 not related to your Q,
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 th
> 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
> | DoesN
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 va
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
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
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
> par
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
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]
http:/
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
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 it
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 new feature at all.
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 happens if you set
> list_
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 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
>
> CONSTANT = _("Hello World")
> x = {'var': CONST
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
> generated and not buffered
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 using a BooleanField(
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 up on the website, all
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 = Fore
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, verbosity=1,
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,
blank
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 'posts' that meet comple
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 URL
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
-Aar
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 Djan
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 f
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 transl
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 o
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 th
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 instance of mysql:
> People
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 tha
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 instance of mysql:
People
Books
I have made the connection in the settings.py at the project level but
in the individual appl
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 membe
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.
--
Yo
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 a
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
screen
> 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 dif
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
http://bitbucket.org/izi/django-admin-tools/overview/).
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" g
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 to the
> DB.
>
> Shoul
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
default),
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 this group, send email to django-us...@google
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-
> oranges"-thing that I hear so of
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 this group, send email t
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
django-users+unsubscr...@googlegroups.com
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 get_object_or_404,
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 b
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 __
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 fiel
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 uns
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 org
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
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 of
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 ano
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.
>
> Is there anything I can do about this? I ass
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 ad
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 li
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
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 "was_published_today"
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 locat
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 locat
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
pronounce the mod_wsgi setup I hav
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,
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 problem I have - and I may be th
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 HttpResponses using
> render_to_res
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 render_to_response("registration/regi
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
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 valid
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, a
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),
> empty_label= None,
>
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,
)
T
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 t
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 be
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 =
self.rel.to._default_manager.using(
82 matches
Mail list logo