Re: Error: 'unicode' object has no attribute 'strftime'. Just added models.DateField
bump On Jul 31, 2:53 pm, Greg <[EMAIL PROTECTED]> wrote: > Russ, > Ha...sorry I'm such a idiot. > > I think I got in now (If not...you might need to help me find it). > > My Zip file that I downloaded is labeled sqlite-3_3_15. Is that what > you need? > > Sorry about this confusion Russ > > Thanks > > On Jul 31, 9:10 am, "Russell Keith-Magee" <[EMAIL PROTECTED]> > wrote: > > > On 7/31/07, Greg <[EMAIL PROTECTED]> wrote: > > > > pysqlite2.3.3 > > > That's just the binding. What version of SQLite itself? > > > Russ %-) --~--~-~--~~~---~--~~ 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 To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: Error: 'unicode' object has no attribute 'strftime'. Just added models.DateField
Russ, Ha...sorry I'm such a idiot. I think I got in now (If not...you might need to help me find it). My Zip file that I downloaded is labeled sqlite-3_3_15. Is that what you need? Sorry about this confusion Russ Thanks On Jul 31, 9:10 am, "Russell Keith-Magee" <[EMAIL PROTECTED]> wrote: > On 7/31/07, Greg <[EMAIL PROTECTED]> wrote: > > > > > pysqlite2.3.3 > > That's just the binding. What version of SQLite itself? > > Russ %-) --~--~-~--~~~---~--~~ 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 To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: Error: 'unicode' object has no attribute 'strftime'. Just added models.DateField
On 7/31/07, Greg <[EMAIL PROTECTED]> wrote: > > pysqlite2.3.3 That's just the binding. What version of SQLite itself? Russ %-) --~--~-~--~~~---~--~~ 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 To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: Error: 'unicode' object has no attribute 'strftime'. Just added models.DateField
Russ, pysqlite2.3.3 On Jul 30, 7:20 pm, "Russell Keith-Magee" <[EMAIL PROTECTED]> wrote: > On 7/31/07, Greg <[EMAIL PROTECTED]> wrote: > > > > > I guess I have v3. In my settings.py file i have: > > > DATABASE_ENGINE = 'sqlite3' > > That's just what your settings file says. This setting could read > sqlite3 even if you don't have sqlite installed. > > Yours > Russ Magee %-) --~--~-~--~~~---~--~~ 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 To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: Error: 'unicode' object has no attribute 'strftime'. Just added models.DateField
On 7/31/07, Greg <[EMAIL PROTECTED]> wrote: > > I guess I have v3. In my settings.py file i have: > > DATABASE_ENGINE = 'sqlite3' That's just what your settings file says. This setting could read sqlite3 even if you don't have sqlite installed. Yours Russ Magee %-) --~--~-~--~~~---~--~~ 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 To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: Error: 'unicode' object has no attribute 'strftime'. Just added models.DateField
Russ, I guess I have v3. In my settings.py file i have: DATABASE_ENGINE = 'sqlite3' On Jul 30, 6:57 pm, "Russell Keith-Magee" <[EMAIL PROTECTED]> wrote: > On 7/31/07, Greg <[EMAIL PROTECTED]> wrote: > > > > > Russ, > > I'm using SQLite version - 0.99svn. And here is my django info > > Ermm.. are you sure? Django requires v3 of SQLite, and pysqlite v2 > bindings... I can't even think where you would get a subversion > release of SQLite 0.99. If you really _do_ have an sqlite that is that > old, we could have found your problem. > > > C:\Python24\Lib\site-packages\django>svn info > > Revision: 5709 > > Ok - so its relatively recent. We can rule that out as the issue. > > Yours, > Russ Magee %-) --~--~-~--~~~---~--~~ 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 To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: Error: 'unicode' object has no attribute 'strftime'. Just added models.DateField
On 7/31/07, Greg <[EMAIL PROTECTED]> wrote: > > Russ, > I'm using SQLite version - 0.99svn. And here is my django info Ermm.. are you sure? Django requires v3 of SQLite, and pysqlite v2 bindings... I can't even think where you would get a subversion release of SQLite 0.99. If you really _do_ have an sqlite that is that old, we could have found your problem. > C:\Python24\Lib\site-packages\django>svn info > Revision: 5709 Ok - so its relatively recent. We can rule that out as the issue. Yours, Russ Magee %-) --~--~-~--~~~---~--~~ 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 To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: Error: 'unicode' object has no attribute 'strftime'. Just added models.DateField
Russ, I'm using SQLite version - 0.99svn. And here is my django info C:\Python24\Lib\site-packages\django>svn info Path: . URL: http://code.djangoproject.com/svn/django/trunk/django Repository Root: http://code.djangoproject.com/svn Repository UUID: bcc190cf-cafb-0310-a4f2-bffc1f526a37 Revision: 5709 Node Kind: directory Schedule: normal Last Changed Author: mtredinnick Last Changed Rev: 5708 Last Changed Date: 2007-07-15 05:10:44 -0500 (Sun, 15 Jul 2007) Thanks On Jul 30, 8:43 am, "Russell Keith-Magee" <[EMAIL PROTECTED]> wrote: > On 7/30/07, Greg <[EMAIL PROTECTED]> wrote: > > > > > Russell, > > I'm using sqlite > > > DATABASE_ENGINE = 'sqlite3' > > Hrm. I don't get this problem with sqlite, either; b.timestamp returns > a datetime object for me. > > It is possible this might be a problem specific to sqlite on Windows - > I don't currently have access to a Windows machine to test this theory > - but I'm not inclined to believe this, as I'm sure other users would > have complained. > > What version of SQLite and pysqlite are you using? > > > I can't seem to find out what django revision I have. I ran 'svn > > info' from c:/django however it said 'svn: '.' is not a working copy' > > That command will only work if you installed Django using svn, and > c:\django is the root of your Django checkout (i.e., the directory > with AUTHORS, INSTALL, LICENSE, MANIFEST.in, README, etc). > > How (and where) did you install Django? > > Yours, > Russ Magee %-) --~--~-~--~~~---~--~~ 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 To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: Error: 'unicode' object has no attribute 'strftime'. Just added models.DateField
On 7/30/07, Greg <[EMAIL PROTECTED]> wrote: > > Russell, > I'm using sqlite > > DATABASE_ENGINE = 'sqlite3' Hrm. I don't get this problem with sqlite, either; b.timestamp returns a datetime object for me. It is possible this might be a problem specific to sqlite on Windows - I don't currently have access to a Windows machine to test this theory - but I'm not inclined to believe this, as I'm sure other users would have complained. What version of SQLite and pysqlite are you using? > I can't seem to find out what django revision I have. I ran 'svn > info' from c:/django however it said 'svn: '.' is not a working copy' That command will only work if you installed Django using svn, and c:\django is the root of your Django checkout (i.e., the directory with AUTHORS, INSTALL, LICENSE, MANIFEST.in, README, etc). How (and where) did you install Django? Yours, Russ Magee %-) --~--~-~--~~~---~--~~ 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 To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: Error: 'unicode' object has no attribute 'strftime'. Just added models.DateField
Russell, I'm using sqlite DATABASE_ENGINE = 'sqlite3' I can't seem to find out what django revision I have. I ran 'svn info' from c:/django however it said 'svn: '.' is not a working copy' On Jul 30, 6:49 am, "Russell Keith-Magee" <[EMAIL PROTECTED]> wrote: > On 7/30/07, Greg <[EMAIL PROTECTED]> wrote: > > > > > Russ, > > Here is what I get with I use 'python manage.py shell' > ... > > >>> b.timestamp > > u'2007-07-29' > > Ok - this is interesting. This should be a datetime object. This > suggests a problem with the database backend. > > I've just tried what you've sent me using the PostgreSQL backend, and > I haven't had any difficulties. > > To repeat two questions I asked previously, what is: > > > > > > - The exact revision of Django you are using > > > > > - The database backend you are using > > Yours, > Russ Magee %-) --~--~-~--~~~---~--~~ 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 To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: Error: 'unicode' object has no attribute 'strftime'. Just added models.DateField
On 7/30/07, Greg <[EMAIL PROTECTED]> wrote: > > Russ, > Here is what I get with I use 'python manage.py shell' ... > >>> b.timestamp > u'2007-07-29' Ok - this is interesting. This should be a datetime object. This suggests a problem with the database backend. I've just tried what you've sent me using the PostgreSQL backend, and I haven't had any difficulties. To repeat two questions I asked previously, what is: > > > > - The exact revision of Django you are using > > > > - The database backend you are using Yours, Russ Magee %-) --~--~-~--~~~---~--~~ 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 To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: Error: 'unicode' object has no attribute 'strftime'. Just added models.DateField
Russ, Here is what I get with I use 'python manage.py shell' >>> b = Orders.objects.get(pk=1) >>> b.s_name u'Bob Smith'' >>> b.timestamp u'2007-07-29' >>> No errors when I access the timestamp property from within the python shell. On Jul 30, 12:00 am, Greg <[EMAIL PROTECTED]> wrote: > Russ, > Here is my Orders Class: > > class Orders(models.Model): > timestamp = models.DateField() > b_name = models.CharField("Billing Name", maxlength=100) > b_address = models.CharField("Billing Address", maxlength=100) > b_city = models.CharField("Billing City", maxlength=100) > b_state = models.USStateField("Billing State") > b_zip = models.CharField("Billing Zip", maxlength=100) > b_phone = models.CharField("Billing Phone", maxlength=100) > b_email = models.EmailField("Billing Email") > s_name = models.CharField("Name", maxlength=100) > s_address = models.CharField("Shipping Address", maxlength=100) > s_city = models.CharField("Shipping City", maxlength=100) > s_state = models.USStateField("Shipping State") > s_zip = models.CharField("Shipping Zip", maxlength=100) > s_phone = models.CharField("Shipping Phone", maxlength=100) > s_email = models.EmailField("Shipping Email") > amount = models.CharField("Order Amount", maxlength=100) > card_number = models.CharField("Card Number", maxlength=100) > exp_date = models.CharField("Exp. Date", maxlength=100) > card_code = models.CharField("Card Code", maxlength=100) > order_status = models.ForeignKey(OrderStatus) > voided = models.BooleanField("Has order been voided?") > email = models.BooleanField("Has an email been sent") > order = models.TextField("Details of Order", maxlength=1000) > comments = models.TextField("none", maxlength=1000) > > class Admin: > list_display = ('s_name', 'order_status') > > def __str__(self,): > return self.s_name > > On Jul 29, 11:59 pm, Greg <[EMAIL PROTECTED]> wrote: > > > Russ, > > Here is my traceback: > > > Traceback (most recent call last): > > File "c:\Python24\lib\site-packages\django\core\handlers\base.py" in > > get_response > > 77. response = callback(request, *callback_args, **callback_kwargs) > > File "c:\Python24\lib\site-packages\django\contrib\admin\views > > \decorators.py" in _checklogin > > 55. return view_func(request, *args, **kwargs) > > File "c:\Python24\lib\site-packages\django\views\decorators\cache.py" > > in _wrapped_view_func > > 39. response = view_func(request, *args, **kwargs) > > File "c:\Python24\lib\site-packages\django\contrib\admin\views > > \main.py" in change_stage > > 370. new_data = manipulator.flatten_data() > > File "c:\Python24\lib\site-packages\django\db\models\manipulators.py" > > in flatten_data > > 250. new_data.update(f.flatten_data(fol, obj)) > > File "c:\Python24\lib\site-packages\django\db\models\fields > > \__init__.py" in flatten_data > > 514. return {self.attname: (val is not None and val.strftime("%Y-%m- > > %d") or '')} > > > AttributeError at /admin/rugs/orders/1/ > > 'unicode' object has no attribute 'strftime' > > > On Jul 29, 11:34 pm, "Russell Keith-Magee" <[EMAIL PROTECTED]> > > wrote: > > > > On 7/30/07, Greg <[EMAIL PROTECTED]> wrote: > > > > > Russ, > > > > I tried including the code that you recommended. However, I'm still > > > > getting the same error: > > > > > AttributeError at /admin/rugs/orders/1/ > > > > 'unicode' object has no attribute 'strftime' > > > > Just to clarify - If you create, modify and save an object at the > > > command prompt, it works fine. You can retrieve the object using the > > > command line using calls to filter, etc, and print out objects > > > retrieved (e.g., print Order.objects.get(pk=1) ). However, when you > > > view the object in the admin pages you get an error. Is this correct? > > > > If this is the case, it is possible that you have encountered some > > > sort of bug with the admin views dealing with date fields; to help > > > track this down, could you provide: > > > > - A full stack trace of the error you are seeing > > > - The exact revision of Django you are using > > > - The code for the Order model > > > - The database backend you are using > > > > Thanks, > > > Russ Magee %-) --~--~-~--~~~---~--~~ 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 To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: Error: 'unicode' object has no attribute 'strftime'. Just added models.DateField
Russ, Here is my view: def success(request): f = processpay(request) if f == 'True': pr = theamount(request) o = Orders() o.timestamp = datetime.now() o.s_name = 'Bob Smith' o.s_address = '18sdf est 15' o.s_city = 'New York' o.s_state = 'NY' o.s_zip = '44801' o.s_phone = '123-123-1321' o.s_email = '[EMAIL PROTECTED]' o.b_name = 'Bob' o.b_address = 'asdf' o.b_city = 'adsf' o.b_state = 'NY' o.b_zip = '1' o.b_phone = '123-132-1231' o.b_email = '[EMAIL PROTECTED]' o.amount = '200' o.card_number = '123123123123' o.exp_date = '0909' o.card_code = '509' o.order_status_id = '1' o.voided = 'False' o.email = 'False' o.order = 'Order Info' o.comments = 'Comment Info' o.save() odet = request.session['orderdetails'] c = request.session['cart'] p = request.session['pad'] del request.session['orderdetails'] del request.session['cart'] del request.session['pad'] request.session.modified = True return render_to_response('result.html', {'s': odet, 'r': c, 'spad': p, 'p': pr}) else: return render_to_response('result.html', {'s': 'Did not work'}) On Jul 30, 12:00 am, Greg <[EMAIL PROTECTED]> wrote: > Russ, > Here is my Orders Class: > > class Orders(models.Model): > timestamp = models.DateField() > b_name = models.CharField("Billing Name", maxlength=100) > b_address = models.CharField("Billing Address", maxlength=100) > b_city = models.CharField("Billing City", maxlength=100) > b_state = models.USStateField("Billing State") > b_zip = models.CharField("Billing Zip", maxlength=100) > b_phone = models.CharField("Billing Phone", maxlength=100) > b_email = models.EmailField("Billing Email") > s_name = models.CharField("Name", maxlength=100) > s_address = models.CharField("Shipping Address", maxlength=100) > s_city = models.CharField("Shipping City", maxlength=100) > s_state = models.USStateField("Shipping State") > s_zip = models.CharField("Shipping Zip", maxlength=100) > s_phone = models.CharField("Shipping Phone", maxlength=100) > s_email = models.EmailField("Shipping Email") > amount = models.CharField("Order Amount", maxlength=100) > card_number = models.CharField("Card Number", maxlength=100) > exp_date = models.CharField("Exp. Date", maxlength=100) > card_code = models.CharField("Card Code", maxlength=100) > order_status = models.ForeignKey(OrderStatus) > voided = models.BooleanField("Has order been voided?") > email = models.BooleanField("Has an email been sent") > order = models.TextField("Details of Order", maxlength=1000) > comments = models.TextField("none", maxlength=1000) > > class Admin: > list_display = ('s_name', 'order_status') > > def __str__(self,): > return self.s_name > > On Jul 29, 11:59 pm, Greg <[EMAIL PROTECTED]> wrote: > > > Russ, > > Here is my traceback: > > > Traceback (most recent call last): > > File "c:\Python24\lib\site-packages\django\core\handlers\base.py" in > > get_response > > 77. response = callback(request, *callback_args, **callback_kwargs) > > File "c:\Python24\lib\site-packages\django\contrib\admin\views > > \decorators.py" in _checklogin > > 55. return view_func(request, *args, **kwargs) > > File "c:\Python24\lib\site-packages\django\views\decorators\cache.py" > > in _wrapped_view_func > > 39. response = view_func(request, *args, **kwargs) > > File "c:\Python24\lib\site-packages\django\contrib\admin\views > > \main.py" in change_stage > > 370. new_data = manipulator.flatten_data() > > File "c:\Python24\lib\site-packages\django\db\models\manipulators.py" > > in flatten_data > > 250. new_data.update(f.flatten_data(fol, obj)) > > File "c:\Python24\lib\site-packages\django\db\models\fields > > \__init__.py" in flatten_data > > 514. return {self.attname: (val is not None and val.strftime("%Y-%m- > > %d") or '')} > > > AttributeError at /admin/rugs/orders/1/ > > 'unicode' object has no attribute 'strftime' > > > On Jul 29, 11:34 pm, "Russell Keith-Magee" <[EMAIL PROTECTED]> > > wrote: > > > > On 7/30/07, Greg <[EMAIL PROTECTED]> wrote: > > > > > Russ, > > > > I tried including the code that you recommended. However, I'm still > > > > getting the same error: > > > > > AttributeError at /admin/rugs/orders/1/ > > > > 'unicode' object has no attribute 'strftime' > > > > Just to clarify - If you create, modify and save an object at the > > > command prompt, it works f
Re: Error: 'unicode' object has no attribute 'strftime'. Just added models.DateField
Russ, Here is my Orders Class: class Orders(models.Model): timestamp = models.DateField() b_name = models.CharField("Billing Name", maxlength=100) b_address = models.CharField("Billing Address", maxlength=100) b_city = models.CharField("Billing City", maxlength=100) b_state = models.USStateField("Billing State") b_zip = models.CharField("Billing Zip", maxlength=100) b_phone = models.CharField("Billing Phone", maxlength=100) b_email = models.EmailField("Billing Email") s_name = models.CharField("Name", maxlength=100) s_address = models.CharField("Shipping Address", maxlength=100) s_city = models.CharField("Shipping City", maxlength=100) s_state = models.USStateField("Shipping State") s_zip = models.CharField("Shipping Zip", maxlength=100) s_phone = models.CharField("Shipping Phone", maxlength=100) s_email = models.EmailField("Shipping Email") amount = models.CharField("Order Amount", maxlength=100) card_number = models.CharField("Card Number", maxlength=100) exp_date = models.CharField("Exp. Date", maxlength=100) card_code = models.CharField("Card Code", maxlength=100) order_status = models.ForeignKey(OrderStatus) voided = models.BooleanField("Has order been voided?") email = models.BooleanField("Has an email been sent") order = models.TextField("Details of Order", maxlength=1000) comments = models.TextField("none", maxlength=1000) class Admin: list_display = ('s_name', 'order_status') def __str__(self,): return self.s_name On Jul 29, 11:59 pm, Greg <[EMAIL PROTECTED]> wrote: > Russ, > Here is my traceback: > > Traceback (most recent call last): > File "c:\Python24\lib\site-packages\django\core\handlers\base.py" in > get_response > 77. response = callback(request, *callback_args, **callback_kwargs) > File "c:\Python24\lib\site-packages\django\contrib\admin\views > \decorators.py" in _checklogin > 55. return view_func(request, *args, **kwargs) > File "c:\Python24\lib\site-packages\django\views\decorators\cache.py" > in _wrapped_view_func > 39. response = view_func(request, *args, **kwargs) > File "c:\Python24\lib\site-packages\django\contrib\admin\views > \main.py" in change_stage > 370. new_data = manipulator.flatten_data() > File "c:\Python24\lib\site-packages\django\db\models\manipulators.py" > in flatten_data > 250. new_data.update(f.flatten_data(fol, obj)) > File "c:\Python24\lib\site-packages\django\db\models\fields > \__init__.py" in flatten_data > 514. return {self.attname: (val is not None and val.strftime("%Y-%m- > %d") or '')} > > AttributeError at /admin/rugs/orders/1/ > 'unicode' object has no attribute 'strftime' > > On Jul 29, 11:34 pm, "Russell Keith-Magee" <[EMAIL PROTECTED]> > wrote: > > > On 7/30/07, Greg <[EMAIL PROTECTED]> wrote: > > > > Russ, > > > I tried including the code that you recommended. However, I'm still > > > getting the same error: > > > > AttributeError at /admin/rugs/orders/1/ > > > 'unicode' object has no attribute 'strftime' > > > Just to clarify - If you create, modify and save an object at the > > command prompt, it works fine. You can retrieve the object using the > > command line using calls to filter, etc, and print out objects > > retrieved (e.g., print Order.objects.get(pk=1) ). However, when you > > view the object in the admin pages you get an error. Is this correct? > > > If this is the case, it is possible that you have encountered some > > sort of bug with the admin views dealing with date fields; to help > > track this down, could you provide: > > > - A full stack trace of the error you are seeing > > - The exact revision of Django you are using > > - The code for the Order model > > - The database backend you are using > > > Thanks, > > Russ Magee %-) --~--~-~--~~~---~--~~ 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 To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: Error: 'unicode' object has no attribute 'strftime'. Just added models.DateField
Russ, Here is my traceback: Traceback (most recent call last): File "c:\Python24\lib\site-packages\django\core\handlers\base.py" in get_response 77. response = callback(request, *callback_args, **callback_kwargs) File "c:\Python24\lib\site-packages\django\contrib\admin\views \decorators.py" in _checklogin 55. return view_func(request, *args, **kwargs) File "c:\Python24\lib\site-packages\django\views\decorators\cache.py" in _wrapped_view_func 39. response = view_func(request, *args, **kwargs) File "c:\Python24\lib\site-packages\django\contrib\admin\views \main.py" in change_stage 370. new_data = manipulator.flatten_data() File "c:\Python24\lib\site-packages\django\db\models\manipulators.py" in flatten_data 250. new_data.update(f.flatten_data(fol, obj)) File "c:\Python24\lib\site-packages\django\db\models\fields \__init__.py" in flatten_data 514. return {self.attname: (val is not None and val.strftime("%Y-%m- %d") or '')} AttributeError at /admin/rugs/orders/1/ 'unicode' object has no attribute 'strftime' On Jul 29, 11:34 pm, "Russell Keith-Magee" <[EMAIL PROTECTED]> wrote: > On 7/30/07, Greg <[EMAIL PROTECTED]> wrote: > > > > > Russ, > > I tried including the code that you recommended. However, I'm still > > getting the same error: > > > AttributeError at /admin/rugs/orders/1/ > > 'unicode' object has no attribute 'strftime' > > Just to clarify - If you create, modify and save an object at the > command prompt, it works fine. You can retrieve the object using the > command line using calls to filter, etc, and print out objects > retrieved (e.g., print Order.objects.get(pk=1) ). However, when you > view the object in the admin pages you get an error. Is this correct? > > If this is the case, it is possible that you have encountered some > sort of bug with the admin views dealing with date fields; to help > track this down, could you provide: > > - A full stack trace of the error you are seeing > - The exact revision of Django you are using > - The code for the Order model > - The database backend you are using > > Thanks, > Russ Magee %-) --~--~-~--~~~---~--~~ 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 To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: Error: 'unicode' object has no attribute 'strftime'. Just added models.DateField
On 7/30/07, Greg <[EMAIL PROTECTED]> wrote: > > Russ, > I tried including the code that you recommended. However, I'm still > getting the same error: > > AttributeError at /admin/rugs/orders/1/ > 'unicode' object has no attribute 'strftime' Just to clarify - If you create, modify and save an object at the command prompt, it works fine. You can retrieve the object using the command line using calls to filter, etc, and print out objects retrieved (e.g., print Order.objects.get(pk=1) ). However, when you view the object in the admin pages you get an error. Is this correct? If this is the case, it is possible that you have encountered some sort of bug with the admin views dealing with date fields; to help track this down, could you provide: - A full stack trace of the error you are seeing - The exact revision of Django you are using - The code for the Order model - The database backend you are using Thanks, Russ Magee %-) --~--~-~--~~~---~--~~ 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 To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: Error: 'unicode' object has no attribute 'strftime'. Just added models.DateField
Russ, I tried including the code that you recommended. However, I'm still getting the same error: AttributeError at /admin/rugs/orders/1/ 'unicode' object has no attribute 'strftime' /// I updated my view to include the following lines: from datetime import datetime ... o.timestamp = datetime.now() When I drill down on the order from within my admin I still get the error listed above. Thanks On Jul 29, 7:45 pm, "Russell Keith-Magee" <[EMAIL PROTECTED]> wrote: > On 7/30/07, Greg <[EMAIL PROTECTED]> wrote: > > > > > Ok, > > I just added a Field in my Orders class. It looks like this: > ... > > Do I need to put something into my timestamp field when I create the > > Orders instance? For example: > > Yes; your field is a required field, so you will need to provide > timestamp data. DateFields store their data in datatime format; so you > will need to do something like: > > >>> from datetime import datetime > >>> o.timestamp = datetime(2007,7,30) > > To assist with form handling, Django also allows string inputs to date fields: > > >>> o.timestamp = "2007-07-30" > > I would like to be able to create the current date when I' working > > with the Orders instance (o.timestamp) > > For this one, try: > > >>> o.timestamp = datetime.now() > > Yours, > Russ Magee %-) --~--~-~--~~~---~--~~ 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 To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: Error: 'unicode' object has no attribute 'strftime'. Just added models.DateField
On 7/30/07, Greg <[EMAIL PROTECTED]> wrote: > > Ok, > I just added a Field in my Orders class. It looks like this: ... > Do I need to put something into my timestamp field when I create the > Orders instance? For example: Yes; your field is a required field, so you will need to provide timestamp data. DateFields store their data in datatime format; so you will need to do something like: >>> from datetime import datetime >>> o.timestamp = datetime(2007,7,30) To assist with form handling, Django also allows string inputs to date fields: >>> o.timestamp = "2007-07-30" > I would like to be able to create the current date when I' working > with the Orders instance (o.timestamp) For this one, try: >>> o.timestamp = datetime.now() Yours, Russ Magee %-) --~--~-~--~~~---~--~~ 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 To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Error: 'unicode' object has no attribute 'strftime'. Just added models.DateField
Ok, I just added a Field in my Orders class. It looks like this: timestamp = models.DateField("Creation Date") // I create a new instance of the order class below: o = Orders() o.s_name = 'Greg Smith' o.s_address = '123 West Main' o.s_city = 'city' ... (And so on) o.save() Do I need to put something into my timestamp field when I create the Orders instance? For example: o = Orders() o.timestamp = ?? # Not sure what goes here o.s_name = 'Bob' o.s_address = '123 West Main' o.s_city = 'city' ... (And so on) o.save() // Currently, when I save the Orders instance it writes it to the db. I can view the record in my admin. I can open the record and select 'Today' for my timestamp field and click save. However, I get the error ''unicode' object has no attribute 'strftime'' When I try to open the record after I added the timestamp. I would like to be able to create the current date when I' working with the Orders instance (o.timestamp) Any help would be appreciated. Thanks --~--~-~--~~~---~--~~ 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 To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---