try datetime.now().__str__() or if you want to make it pretty try
datetime.now().strftime(YourCustomFormatHere). Look at
http://docs.python.org/lib/strftime-behavior.html#strftime-behavior
Your problem is a datetime object is a not a string. Both those above
examples turn it into a string.
On
Hello,
I have a class called Orders that tries to add the current date to
it's comments field when it's saved. Here is my code:
from datetime import datetime
class Order(models.Model):
comments = models.TextField("Comments", maxlength=1000)
etc...
def save(self):
On Fri, 2007-10-19 at 15:04 -0700, Dr Stitch wrote:
> Greeting all!
>
> CAVEAT: I'm a Django newbie. I've spent about 3 hours searching,
> reading, hazing over all the documentation and tutorials and it's
> quite likely I have missed it or I'm way too new to Django to
> understand the
On 20-Oct-07, at 7:22 AM, Laszlo Marai wrote:
> You can host multiple applications in django but as far as I could see
> from the mailing list you'll have some problem if you want to have two
> different django instances running under mod_python.
not so. There have been reports of over 70
On Fri, 2007-10-19 at 08:24 -0700, web-junkie wrote:
> Hi,
>
> I have a m2m relationship from books to authors. A book can have 0-n
> authors (yes, don't ask why there can be no authors). If I want to do
> a search where I it should match the title or authors, I just gives me
> books that have
On 20-Oct-07, at 7:46 AM, Laszlo Marai wrote:
>>
>> not so. There have been reports of over 70 django instances running
>> under mod_python in the same server. I have 12 in one server without
>> problems.
>
> Wasn't there a question here about mod_python a few days ago where the
> solution was
On Sat, 20 Oct 2007 07:40:27 +0530
Kenneth Gonsalves <[EMAIL PROTECTED]> wrote:
> > You can host multiple applications in django but as far as I could see
> > from the mailing list you'll have some problem if you want to have two
> > different django instances running under mod_python.
>
> not
On 10/19/07, Laszlo Marai <[EMAIL PROTECTED]> wrote:
> So the java solutions need more configuration work but they might be more
> flexible in some cases. And don't forget that you're comparing a set of
> components (java) against a full stack (django). The configuration work
> can be alleviated
On Sat, 20 Oct 2007 00:53:45 -
Francis <[EMAIL PROTECTED]> wrote:
Hi,
I'm quite new to django but have a little insight into java.
> On the other hand, java web framework look quite complicated with lot
> of xml and manual configuration with no real advantage. Java verbosity
Well, it
On 10/19/07, Steve Potter <[EMAIL PROTECTED]> wrote:
>
> I would like to put together a piece of code that will test the
> referer for each request and if it matches a predefined pattern it
> would log that request as well as place a cookie on the client.
>
> Is custom middleware the correct
I would like to put together a piece of code that will test the
referer for each request and if it matches a predefined pattern it
would log that request as well as place a cookie on the client.
Is custom middleware the correct place to do this?
Also, I'm not exactly clear how
Hi,
For personnal information and curiosity, I was looking at the
available java mvc web framework out there.
One thing that I found particular, is that the dynamic language camp
market their framework as productive environnement, easy and so. While
the java framework emphasis on the
I am so close to getting this project done. The last little bit is all
about validation. I have been following the docs pretty closely and am
really at a loss as to what is going on right now. The Error:
TypeError at /videoUploader/
__init__() got an unexpected keyword argument 'field_name'
Here
More friends more money,get friends while get paid
http://groups.google.com/group/all-good-things/web/get-friends-while-get-paid
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups
"Django users" group.
To post to this
Greeting all!
CAVEAT: I'm a Django newbie. I've spent about 3 hours searching,
reading, hazing over all the documentation and tutorials and it's
quite likely I have missed it or I'm way too new to Django to
understand the simplicity of the solution for the problem I'm
presenting. So, feel free
What I need to do is, get the records from the database and split
fields contents. One of the field, has commas separated contents and
another field has - separated fields. In my view, I just do fetchall
of database records and send to view. From the view, I do a for loop
to go through each
On 10/19/07, Marty Alchin <[EMAIL PROTECTED]> wrote:
>
> So instead of trying to use output.custom_format_string1(), you'd just
> do whatever your template tag needs to do.
Which brings up the question, what are you (johhny) trying to do? I'm
unable to grasp the intent of the block tags code
Hi,
I am trying a custom field with a special data field have to handle.
The data is a 4 digit with or with a letter at the end. eg. 9(a),
99(a), 999(a), (a).
class CustCharField(models.CharField):
def __init__(self, *args, **kwargs):
models.CharField.__init__(self, max_length=5,
On 10/19/07, johnny <[EMAIL PROTECTED]> wrote:
> upper() in output.upper(), I am assuming is the name of the template
> tag. When I try to do it as in this example, I get an error:
>
>
>
> I didn't understand the output.upper() part. I think the
> documentation above is written for people who
I am looking at this documentation:
http://www.djangoproject.com/documentation/templates_python/#parsing-until-another-block-tag-and-saving-contents
It has the following code:
output = self.nodelist.render(context)
return output.upper()
upper() in output.upper(), I am assuming is the
wow, I'm glad there is a cookbook entry for this :-) thank you
On Oct 19, 3:30 pm, skam <[EMAIL PROTECTED]> wrote:
> You should be able to build a middleware similar
> tohttp://code.djangoproject.com/wiki/CookBookThreadlocalsAndUser,
> getting request.session instead of request.user
My wife and I are travelling through Eastern Europe for the next 2
months. (we're starting in Amsterdam though).
I'd love to meet up with any Djangonauts for a little chat. I like
beer, wine, Django, and open source software if anyone can spare a few
minutes for a chat :)
Cheers
-Brian
On Fri, 2007-10-19 at 13:29 +0100, Chris Hoeppner wrote:
> Huh I lied. The django update only forced me to call that view with
> POST, and now that I'm doing, it's throwing the same traceback. I'm not
> sure what this might be. I'll check again with the system admins.
When you tested at the
I suspect the template processing code is getting confused by:
{% end_custom_format_string2 %)
Which should be:
{% end_custom_format_string2 %}
That is, sqiggly brace, not paren, at the end.
Karen
--~--~-~--~~~---~--~~
You received this message because you
Rob,
Thanks for the reply. In looking at that link I found out about the
Paginator Tag. Which I think is what I need. However, in reading the
documenation about that tag. It says 'To be used in conjunction with
the object_list generic view.' I am not using a generic view. I have
the
On 10/19/07, Ken <[EMAIL PROTECTED]> wrote:
> Thanks for your reply. It was a great help. I followed up on reading
> the HTML spec and the posted data is returned in document order. Next
> section.
Ah, so it is! Color me crazy, but when information about how browsers
should process data
There is a problem with default django for loop tag {% for %} {%
endfor%} . Django template doesn't seem to like nested block tag
inside for loop tag.
{% for a_object in object_list %}
{% load custom_format %}
{% custom_format_string1 a_object.3 %}
{{split_string_data1}}
{%
On Oct 19, 10:37 am, "Marty Alchin" <[EMAIL PROTECTED]> wrote:
> [1]http://www.w3.org/TR/html401/interact/forms.html#h-17.13.3
Thanks for your reply. It was a great help. I followed up on reading
the HTML spec and the posted data is returned in document order. Next
section.
Ken
[1]
Hi guys!
Thanks for those responses. So, the random.randint function does exist:
# python
Python 2.3.5 (#1, Aug 25 2005, 09:17:44)
[GCC 3.4.3 20041212 (Red Hat 3.4.3-9.EL4)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import random
>>> random.randint
>
Did you activate the cache in Django? I once discovered an issue with
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-users@googlegroups.com
I haven't done any testing on this, but I'd like to point out one
thing. The HTML spec[1] doesn't specify anything about browsers having
to assemble the data set in document order. This means that even if
Django made sure that the multivalues are put in POST in the order
they were received, there
I don't think it's 100% to your specs but take a look at this:
http://blog.localkinegrinds.com/2007/09/06/digg-style-pagination-in-django/
It's close enough for tweaking to get you 95% of the way there
(maybe).
--~--~-~--~~~---~--~~
You received this message
Hi,
I have a m2m relationship from books to authors. A book can have 0-n
authors (yes, don't ask why there can be no authors). If I want to do
a search where I it should match the title or authors, I just gives me
books that have an author. Not the other matches. See here for the
code:
I would like to add (if anyone who writes django documentation is
reading) a statement explicitly confirming or denying this in the
documentation would be nice. The fact that django sub-classed a dict
to handle multiple values posted by a form seems to suggest that
multiple values are returned
On Oct 18, 8:07 pm, Thejaswi Puthraya <[EMAIL PROTECTED]>
wrote:
> request.POST is a python dictionary and the keys need not be ordered.
You misunderstand. I know dicts are not ordered in the sense lists
are. My question is this: Suppose I have a form that returns
multiple values for a
Hi,
I though of doing something similar a couple of month ago without reading
about It, I somehow change my mind.
I really like django, but I don't think it is well suite for this kind of
use. What i decide to do is a python client application which use the web
server as a web service to update
OK got it thanks - a redirect works fine :-)
On Oct 19, 3:14 pm, dbee <[EMAIL PROTECTED]> wrote:
> I'm using the Django alias site_media redirect to access static files
> on my server. I have an aspect to my django application whereby the
> user can upload his own files and then access those
I'm using the Django alias site_media redirect to access static files
on my server. I have an aspect to my django application whereby the
user can upload his own files and then access those files to include
them in newsletters etc...
The problem of course is that the user will upload files to
I'm using the Django alias site_media redirect to access static files
on my server. I have an aspect to my django application whereby the
user can upload his own files and then access those files to include
them in newsletters etc...
The problem of course is that the user will upload files to
On Fri, 2007-10-19 at 06:54 -0700, äL wrote:
> I would like to order a list in a view by foreign key. If I try
> ordering how in the
> code below my list is ordered by 'person'. And this means that the
> list
> ist ordered by the ID of the table Person. But I need a list ordered
> by 'nameLast'.
Hi all,
I have severe problems to get my Apache 2 to run mod_python together
with Python 2.5 on Mac OS X 10.4.10.
This is my sad story:
I'm developing a small in-house publication database for bibliometric
purposes. I run a Ubuntu Linux-based server with Apache, Python and
PostgreSQL, but I
I would like to order a list in a view by foreign key. If I try
ordering how in the
code below my list is ordered by 'person'. And this means that the
list
ist ordered by the ID of the table Person. But I need a list ordered
by 'nameLast'.
Thus I changed ordering 'person' into 'person.nameLast'.
Hello friends,
"The Story That Won't Go Away" comes back!
I am a newcomer to Django and just read some posts from one year ago
about creating standalone programs with Django and py2app or py2exe.
What is the status of this issue now? Anyone found a solution?
I need to develop a very simple
Aha, thanks dude :-)
On Oct 19, 12:55 pm, Malcolm Tredinnick <[EMAIL PROTECTED]>
wrote:
> On Fri, 2007-10-19 at 04:32 -0700, dbee wrote:
> > I'm creating a pdf document dynamically, I need to include barchart
> > data in the document. The bar chart data is also created dynamically
> > with
Hi Matthew,
Thanks. The problem is though, that I'm following the docs and using
another class to 'shape' my barchart ...
# Use this one for client
signup
class interests_class(Drawing):
format = 'gif'
def __init__(self, width=400, height=250, *args, **kw):
You should be able to build a middleware similar to
http://code.djangoproject.com/wiki/CookBookThreadlocalsAndUser ,
getting request.session instead of request.user
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups
On 10/18/07, johnny <[EMAIL PROTECTED]> wrote:
[snip]
{% custom_format_string1 a_object.3 %}
...
{% custom_format_string2 a_object.4 %}
...
@register.tag(name="custom_format_sting1")
...
@register.tag(name="custom_format_sting2")
The names you register are missing the r's in "string",
I need to access a session-field in a model, I found this:
http://www.djangoproject.com/documentation/sessions/#using-sessions-out-of-views
but what would be the clean way to find out the session-key? or is
there another way to get the "current" session in a model?
btw: Users are not
> File
> "/usr/lib/python2.3/site-packages/django/contrib/sessions/models.py", line
> 19, in get_new_session_key session_key = md5.new("%s%s%s%s" %
> (random.randint(0, sys.maxint - 1), os.getpid(), time.time(),
> settings.SECRET_KEY)).hexdigest()
>
> AttributeError: 'module' object has no
Can someone help me, plz?
I have two block tags that take an argument and then sets a variable
in the template. The two block tags are inside the template "for
loop" tags, one after another.
On Oct 18, 3:00 pm, johnny <[EMAIL PROTECTED]> wrote:
> I have templatetags/custom_format.py, and in
Huh I lied. The django update only forced me to call that view with
POST, and now that I'm doing, it's throwing the same traceback. I'm not
sure what this might be. I'll check again with the system admins.
El vie, 19-10-2007 a las 21:12 +1000, Malcolm Tredinnick escribi�:
> On Fri, 2007-10-19
I'm creating a pdf document dynamically, I need to include barchart
data in the document. The bar chart data is also created dynamically
with report lab. I can get the barchart data at my url ...
def barchart_interests(request):
.
#get a GIF (or PNG, JPG, or
whatever)
Thanks, Malcolm!
For some reason, updating django to trunk solved it. My system admins
told me kindly that it's not their problem. Very nice indeed.
El vie, 19-10-2007 a las 21:12 +1000, Malcolm Tredinnick escribi�:
> On Fri, 2007-10-19 at 11:56 +0100, Chris Hoeppner wrote:
> > Hey guys!
> >
On Fri, 2007-10-19 at 04:32 -0700, dbee wrote:
> I'm creating a pdf document dynamically, I need to include barchart
> data in the document. The bar chart data is also created dynamically
> with report lab. I can get the barchart data at my url ...
>
> def barchart_interests(request):
>
>
On Fri, 2007-10-19 at 11:56 +0100, Chris Hoeppner wrote:
> Hey guys!
>
> I have no choice but deploy to this server, running CentOS 4.4, with no
> option to upgrade python beyond 2.3, and I'm getting this:
>
> Mod_python error: "PythonHandler django.core.handlers.modpython"
>
> Traceback (most
Hey guys!
I have no choice but deploy to this server, running CentOS 4.4, with no
option to upgrade python beyond 2.3, and I'm getting this:
Mod_python error: "PythonHandler django.core.handlers.modpython"
Traceback (most recent call last):
File
On Thu, 2007-10-18 at 15:25 -0700, Mikkel Høgh wrote:
> I have a bit of a problem - I'm creating a GTD-focused task management
> app for Django, mainly for my own benefit, but it's open source if any
> one cares.
>
> I've been trying to implement a taxonomy system like the one Drupal
> uses.
Hello!
I have just created a project at
http://code.google.com/p/appfusedjango/, the idea is to have a simple
application to start with which shows and solves some of the common
questions one can have when starts a project.
Hope it helps!
--
Antoni Aloy López
Binissalem - Mallorca
58 matches
Mail list logo