Re: 'NoneType' object has no attribute 'datetime' bug?

2012-07-16 Thread dobrysmak
Thank's for help , i did this and now i've got this 

AttributeError at /wejdz-do-gry/76/
'NoneType' object has no attribute 'now'

This is strange because the shell import works fine but the server script 
throus an exception.

>>> from datetime import datetime, time, date
> >>> print datetime.now()
> 2012-07-14 14:14:17.897023
> >>> print datetime.combine(date.today(),time(19,30))
> 2012-07-14 19:30:00
> >>> 
>
Ok, that's true but the script does not even reach the 'combine' function 
it died on 'now'. 

 

W dniu sobota, 14 lipca 2012 19:15:56 UTC+2 użytkownik Guevara napisał:
>
> Try this:
>
> from datetime import datetime, time, date
>
> current_date = datetime.now()
>
> today = datetime.combine(date.today(), time(19,30))
>
> Look:
>
> >>> from datetime import datetime, time, date
> >>> print datetime.now()
> 2012-07-14 14:14:17.897023
> >>> print datetime.combine(date.today(),time(19,30))
> 2012-07-14 19:30:00
> >>> 
>
> o/
>
>
> 2012/7/14 dobrysmak <lukasz.szyman...@gmail.com>
>
>> Hi guys,
>> i have run into this.
>>
>> Traceback:
>> File 
>> "/usr/local/lib/python2.7/dist-packages/django/core/handlers/base.py" in 
>> get_response
>> 111. response = callback(request, *callback_args, **callback_kwargs)
>> File 
>> "/usr/local/lib/python2.7/dist-packages/django/contrib/auth/decorators.py" 
>> in _wrapped_view
>> 20. return view_func(request, *args, **kwargs)
>> File "/usr/local/lib/python2.7/dist-packages/django/utils/decorators.py" 
>> in _wrapped_view
>>  91. response = view_func(request, *args, **kwargs)
>> File "/home/user/dev/xyz/coupon/views.py" in enter_game
>> 69. Coupon(coupon=coupon, player=player, credicts=credicts).save()
>> File "/home/user/dev/xyz/coupon/models.py" in save
>> 253. self.coupon.close_coupon()
>> File "/home/user/dev/xyz/coupon/models.py" in close_coupon
>>  78. current_date = datetime.datetime.now()
>>
>> Exception Type: AttributeError at /wejdz-do-gry/49/
>> Exception Value: 'NoneType' object has no attribute 'datetime'
>> Request information:
>> GET: No GET data
>>
>> and the cuntion "close_coupon" looks like this
>>
>> class Coupon(models.Model): .
>> .
>>  . end_date = models.DateTimeField(default=None, null=True, blank=True) 
>> def close_coupon(self):
>> current_date = datetime.datetime.now() today = 
>> datetime.datetime.combine(datetime.date.today(), datetime.time(19,30))
>> .
>>   .
>> end_date = current_date
>>
>> Don't know if that's a bug. Does anyone know how to deal with this issue? 
>> Cheers!
>>
>> -- 
>> You received this message because you are subscribed to the Google Groups 
>> "Django users" group.
>> To view this discussion on the web visit 
>> https://groups.google.com/d/msg/django-users/-/iH-0-noK-zkJ.
>> To post to this group, send email to django-users@googlegroups.com.
>> To unsubscribe from this group, send email to 
>> django-users+unsubscr...@googlegroups.com.
>> For more options, visit this group at 
>> http://groups.google.com/group/django-users?hl=en.
>>
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/django-users/-/cqKjBDZ5XgEJ.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



'NoneType' object has no attribute 'datetime' bug?

2012-07-14 Thread dobrysmak
Hi guys,
i have run into this.

Traceback:
File "/usr/local/lib/python2.7/dist-packages/django/core/handlers/base.py" 
in get_response
111. response = callback(request, *callback_args, **callback_kwargs)
File 
"/usr/local/lib/python2.7/dist-packages/django/contrib/auth/decorators.py" 
in _wrapped_view
20. return view_func(request, *args, **kwargs)
File "/usr/local/lib/python2.7/dist-packages/django/utils/decorators.py" in 
_wrapped_view
91. response = view_func(request, *args, **kwargs)
File "/home/user/dev/xyz/coupon/views.py" in enter_game
69. Coupon(coupon=coupon, player=player, credicts=credicts).save()
File "/home/user/dev/xyz/coupon/models.py" in save
253. self.coupon.close_coupon()
File "/home/user/dev/xyz/coupon/models.py" in close_coupon
78. current_date = datetime.datetime.now()

Exception Type: AttributeError at /wejdz-do-gry/49/
Exception Value: 'NoneType' object has no attribute 'datetime'
Request information:
GET: No GET data

and the cuntion "close_coupon" looks like this

class Coupon(models.Model): .
.
. end_date = models.DateTimeField(default=None, null=True, blank=True) 
def close_coupon(self):
current_date = datetime.datetime.now() today = 
datetime.datetime.combine(datetime.date.today(), datetime.time(19,30))
.
  .
end_date = current_date

Don't know if that's a bug. Does anyone know how to deal with this issue? 
Cheers!

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/django-users/-/iH-0-noK-zkJ.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Content type raw_id_fields

2012-04-20 Thread dobrysmak
Hi, i have got a question, been figthing with this pass few days.

How to make raw_id_fields in content type model in admin backend?
Or how to display formset for picked content type in inline forms?

Cheers!

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/django-users/-/m0fA_B8K4q0J.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: tornadio2 cached results

2012-03-15 Thread dobrysmak
Figured out that tornadio2 or tornado is somehow keepeing django's orm data 
in memory pulling that same data on each db request.
When i'm reffering to mysql database via  python MySQLdb, making connection 
each request. i'm getting updated results, that's ok. 

How to force tornadio2/tornado to get the updated data from db via django?


-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/django-users/-/IV4QqgcUePQJ.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



tornadio2 cached results

2012-03-15 Thread dobrysmak
Hi, 
i'm running tornadio2 server with socket.io and i run into a problem, when 
i'm getting some data from db via django's orm the socket server doesn't 
want to get new fresh data from db, every time the event occurs. He's just 
keeping the same data from begging.
Does anyone had same problem?

Bye.  

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/django-users/-/MAJL0l_fzpQJ.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



using django with socketio

2012-03-07 Thread dobrysmak
Hi guys,
long story short, i'm using* django-socketio* with my app on nginx + uwsgi 
+ tcp_module  and i 
cant get it to work with the browser on production server.
Here's short conf  

Any ideas how to get it to work? or is there other way to use socket.io 
(besides 
Noje.js) with Django framework?
Cheers!

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/django-users/-/wu7A5P7pYJgJ.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.