Case is this
XXXXXXX | date "F J Y"
It should read in the format that i choosen but instead of this gives
this error
TemplateSyntaxError at /mypage/
Could not parse the remainder: | date "F J Y"
Request Method: GET
Request URL: http://127.0.0.1:8000/mypage/
Exception Type: TemplateSyntaxError
Exception Value: Could not parse the remainder: | date "F J Y"
Even I followed the from this post itself. But Unable to do. could any
body tell what the problem exactly.
Even I tryed to import the file name dateformat.py from utils
but still stuck at the same point.
Help
Regards
Alok Tiwari
You want
{{ XXXXXXXX | date:"F J Y" }}
You missed the colon.
On Mar 14, 7:34 pm, "bax...@gretschpages.com" <mail.bax...@gmail.com>
wrote:
I've been bitten by this one several times. I haven't seen any
notes to the effect, but for some reason, the template parser
doesn't seem like extra whitespace. You'll also want to separate
your "date" from its argument with the colon:
fails: XXXX | date "F J Y"
works: XXXX|date:"F J Y"
I'll agree that whitespace makes it more readable, and that it
would be nice if the template engine was a little more forgiving.
But fortunately, it's an easy fix to just remove the whitespace.
Perhaps a little caveat about whitespace at
http://www.djangoproject.com/documentation/templates/#filters
would help reduce confusion?
-tkc
AttributeError at /registration/
'FormFieldWrapper' object has no attribute 'month'
Request Method: GET
Request URL: http://127.0.0.1:8000/registration/
Exception Type: AttributeError
Exception Value: 'FormFieldWrapper' object has no attribute 'month'
Exception Location: c:\Python24\Lib\site-packages\django\utils
\dateformat.py in F, line 123
glad to help
> But stuck again
>
> AttributeError at /registration/
> 'FormFieldWrapper' object has no attribute 'month'
Well, somewhere in your code, you're asking for the "month"
attribute of an object. And that object doesn't have a "month"
property, so it raises the AttributeError exception.
This might stem from assigning a non-date value to a DateField
value, and then trying to read it back. Or it might stem from
assigning None to such an attribute (though IIRC, that raises
something like "'NoneType' object has no attribute 'month'". Or
you might be passing something that's a non-date to a "date" filter.
-tkc
No spaces before or after the bar, no spaces before or after the colon:
{{ somvar|date:"F j y" }}
--
"Bureaucrat Conrad, you are technically correct -- the best kind of correct."
But not able to change the date format still
I tryed to poke the source code of django
that have a file json.py
at line number 35 their is a class stated as
class DateTimeAwareJSONEncoder(simplejson.JSONEncoder):
"""
JSONEncoder subclass that knows how to encode date/time types
"""
DATE_FORMAT = "%Y-%m-%d"
TIME_FORMAT = "%H:%M:%S"
Does it makes any sense. sience I have already installed the django. I
don't guess that should work here.do i reinstall the django with the
DATE_FORMAT Change to "%d/%m%Y"
?????
Stuck Guys Help me
Although after reading this
http://groups.google.com/group/django-users/browse_thread/thread/f0e7d503401a7186/a20885d604dcad7a?lnk=gst&q=%7Cdate%3A%22Y+m+d%22&rnum=2#a20885d604dcad7a
I changed the date field to datetime field
The
On Mar 15, 12:58 am, "James Bennett" <ubernost...@gmail.com> wrote:
Reading the error message gives a clue as to what is going wrong here:
you are not formatting a datetime object, you are trying to call the
filter on a FormFieldWrapper object, which won't work. It sounds like
you are getting confused about the types of variables in your template
-- maybe you are accidently calling two things by the same name in your
view function or something like that.
Trim your problem down to a very small example. Make it a template that
only displays this one thing. Then make sure the error still occurs (if
not, introduce more things until it happens again). Then start removing
things from your view so that you are only passing the single variable
into the template, checking that the error occurs each time. At some
point, you will find the error goes away, so you will have more
information about what the critical line of code is.
Regards,
Malcolm
# Simplyfied date format change that I wish to use in django
import datetime
t = datetime.date.today()
print t.strftime("%Y,%m,%d")
print "My Required Date Format is "
print t.strftime("%d,%m,%Y")
Can't i call this program to django to change the date format. if yes
then let me know.
Regards
Alok
On Mar 15, 11:27 am, Malcolm Tredinnick <malc...@pointy-stick.com>
wrote:
> On Thu, 2007-03-15 at 05:58 +0000, mralokkp wrote:
> > Thanks James but the spaces had been removed
> > If Spaces it gives template error.
> > If not it gives the former error
> > says
> > AttributeError at /registration/
> > 'FormFieldWrapper' object has no attribute 'month'
> > had resolved
>
> Reading the error message gives a clue as to what is going wrong here:
> you are not formatting a datetime object, you are trying to call thefilteron a FormFieldWrapper object, which won't work. It sounds like
Yes, you use the date filter in the template to do this. The error you
were seeing said you were not applying that filter to a date or datetime
variable, though. To work out why the variable does not contain what you
think, it might help to trim down your example as I suggested before.
That way you could post exactly what you are doing and it will only be a
few lines long.
Malcolm
Even Tryed this
http://magpiebrain.com/blog/2005/08/21/formatting-dates-with-django/
Covered Both Example
But Unable to get any clue.
Unable to find any proper documentation / Code example for this
I am new to Django. Advanced Thank
Regards
On Mar 15, 12:23 pm, Malcolm Tredinnick <malc...@pointy-stick.com>
wrote: