These are chat archives for django/django

7th
Jun 2017
Amrit Kumar Sharma
@AmritKrsh
Jun 07 2017 04:33
anyone can tell integrating with angular
John
@flyboy1565
Jun 07 2017 05:03
A guy on youtube does a really good tutorial for Django and angular.. codingforentrepreneurs
@AmritKrsh
:]
@elcolie
Jun 07 2017 14:19
Hi
I have question on timezone
2017-05-31 07:15:27----2017-06-07 07:15:27
2017-05-31 14:15:27----2017-06-07 14:15:27
> /Users/el/Code/uih-spot/uihspot/apps/dashboard/utils.py(43)gen_report_one()
-> filter_datetime = AccessLog.objects.filter(created_at__range=(bkk_start_datetime, bkk_end_datetime))
(Pdb) AccessLog.objects.all()
<QuerySet [<AccessLog: AccessLog object>, <AccessLog: AccessLog object>, <AccessLog: AccessLog object>, <AccessLog: AccessLog object>, <AccessLog: AccessLog object>]>
(Pdb) for i in AccessLog.objects.all(): print(i.created_at)
2017-06-07 14:14:02.554455+00:00
2017-06-07 14:18:03.049339+00:00
2017-06-07 14:15:02.523499+00:00
2017-06-07 14:16:02.695194+00:00
2017-06-07 14:13:02.837689+00:00
2017-06-07 14:17:02.814835+00:00
(Pdb) utc_start_datetime
datetime.datetime(2017, 5, 31, 7, 15, 27, 415629, tzinfo=<UTC>)
(Pdb) utc_end_datetime
datetime.datetime(2017, 6, 7, 7, 15, 27, 415629, tzinfo=<UTC>)
(Pdb) AccessLog.objects.filter(created_at__range=(utc_start_datetime, utc_end_datetime))
TIME_ZONE = 'Asia/Bangkok'

USE_I18N = True

USE_L10N = True

USE_TZ = True
I can not search by neither utc nor bkk timezone
(Pdb) AccessLog.objects.filter(created_at__range=(utc_start_datetime, utc_end_datetime))
<QuerySet []>
(Pdb) AccessLog.objects.filter(created_at__range=(bkk_start_datetime, bkk_end_datetime))
<QuerySet []>
:]
@elcolie
Jun 07 2017 14:48
I solve timezone already
Can you use single inline for this
    username_list = set()
    for item in filter_datetime:
        for sub_item in item.spot_content:
            if sub_item.get('user') != '':
                username_list.add(sub_item.get('user'))
Harshith s
@harshiths716
Jun 07 2017 15:34
Hi
Houzayfa Rifai
@hozRifai
Jun 07 2017 19:13
Anyone can share with us best practice with django 1.11 $_$
It's cost 42$ and it is so expensive 😊
Ana María Benites Rodríguez
@anitabenites
Jun 07 2017 19:35
hi!!, in Python, keys in a dictionary can be strings, tuples or integers, isn't? and since keys for dictionaries must be unique such as security numbers, student's IDs, when would a key other than a string be useful in a dictionary?
Houzayfa Rifai
@hozRifai
Jun 07 2017 22:05

urlpatterns = [

# /talks_app
url(r'^/$', views.HomePageView.as_view(), name='home'),
# /talks_app/register
url(r'^register/' ,views.SignUpView.as_view(), name='signup'),

]
any idea why /talks_app/register not working

Garrus Napp
@GarrusNapp
Jun 07 2017 22:12
@hozRifai doesn't work at all or it goes to your home view
Houzayfa Rifai
@hozRifai
Jun 07 2017 22:19
@GarrusNapp doesn't work at all
Garrus Napp
@GarrusNapp
Jun 07 2017 22:20
so neither of the regex is working probably
im not good at regex, just play with adding or removing / here and there, or wait for someone clever to answer :D
i tried this [^a-zA-Z0-9_] but :(
Houzayfa Rifai
@hozRifai
Jun 07 2017 22:34

i created another app and i included it in urls
and in my new app urls i wrote

register

url(r'^/', views.SignUpView.as_view(), name='signup'),

and it's work fie so thats mean it is an re issue yeah !

@GarrusNapp
Houzayfa Rifai
@hozRifai
Jun 07 2017 22:48
finally i solve it :)
this is how i solve it

/talks_app/register

url(r'^/(?P<anystring>\w+)/', views.SignUpView.as_view(), name='signup'),
Cesar Cotiz
@cotizcesar
Jun 07 2017 22:57
Im just starting with Django, any advice?
and Hi
:)
Houzayfa Rifai
@hozRifai
Jun 07 2017 23:28
me too
probably this is the best tutorial
the documentation has a lot to learn
ad this video is amazing to understand everything