Login with email address, mobile number or username.

2018-04-19 Thread lakshitha kumara
Hello Guys ,

what is the best way to implement Login with email address, mobile number 
or username. all those field save as a different field in user table. user 
can login with any criteria that user provided to registered. its look like 
how instagram.com does it. i need know what is the best way to implement 
this. Username field cant include '@' sign and username should be letter, 
number and '_' .

Thanks

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/cd1ce71e-89e8-4ebf-960f-9a72a231eb6a%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: tutorial01 is not working

2018-04-24 Thread lakshitha kumara
Look like url is missing. try to add this line to urls.py

from django.urls import path
from . import views
urlpatterns = [
path('', views.index, name='index'),]


On Tuesday, April 24, 2018 at 5:04:33 PM UTC+5:30, aljom...@live.com wrote:
>
> hi. i'm new to django dev. so i'm following the tutorial at 
> https://docs.djangoproject.com/en/2.0/intro/tutorial01/ 
>
> i copied and pasted the code samples so as not to introduce typing 
> mistakes. everything works fine until i reached the "polls" section. i get 
> below errors: 
>
> Page not found (404) 
> Request Method: GET 
> Request URL: http://127.0.0.1:8000/polls/ 
>
> Using the URLconf defined in mysite.urls, Django tried these URL patterns, 
> in this order: 
>
> admin/ 
>
> The current path, polls/, didn't match any of these. 
>
> You're seeing this error because you have DEBUG = True in your Django 
> settings file. Change that to False, and Django will display a standard 404 
> page. 
>
> when i open http://127.0.0.1:8000/polls/ 
>
> what could be the reason? 
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/f42defe7-2712-43e9-b0a4-ab8491b7f328%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Current user ip address on form.py

2018-04-27 Thread lakshitha kumara
Hello Guys

Is there way to get current user ip address on form.py 

Thanks

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/d7edf4df-90c5-4b48-afd5-a31fd157d2f2%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Current user ip address on form.py

2018-04-27 Thread lakshitha kumara
Hello Andréas

Thank for your reply. but unfortunately i need get user ip on form.py or 
custom py file in django. is there way to to that ? 
 
Some one post on this example can be work but its also doesn't work 

class RegistrationForm(UserCreationForm):

def __init__(self, *args, **kwargs):
self.request = kwargs.pop('request')
super(RegistrationForm, self).__init__(*args, **kwargs)

On Friday, April 27, 2018 at 6:06:36 PM UTC+5:30, Andréas Kühne wrote:
>
> Hi,
>
> You can get the IP address from the request. See here:
>
> https://stackoverflow.com/questions/4581789/how-do-i-get-user-ip-address-in-django
>
> Regards,
>
> Andréas
>
> 2018-04-27 14:28 GMT+02:00 lakshitha kumara  >:
>
>> Hello Guys
>>
>> Is there way to get current user ip address on form.py 
>>
>> Thanks
>>
>> -- 
>> You received this message because you are subscribed to the Google Groups 
>> "Django users" group.
>> To unsubscribe from this group and stop receiving emails from it, send an 
>> email to django-users...@googlegroups.com .
>> To post to this group, send email to django...@googlegroups.com 
>> .
>> Visit this group at https://groups.google.com/group/django-users.
>> To view this discussion on the web visit 
>> https://groups.google.com/d/msgid/django-users/d7edf4df-90c5-4b48-afd5-a31fd157d2f2%40googlegroups.com
>>  
>> <https://groups.google.com/d/msgid/django-users/d7edf4df-90c5-4b48-afd5-a31fd157d2f2%40googlegroups.com?utm_medium=email&utm_source=footer>
>> .
>> For more options, visit https://groups.google.com/d/optout.
>>
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/f82200e2-f329-450e-a8a0-1eaf2dc07bc2%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


New language adding error('Unknown language code si.')

2018-04-29 Thread lakshitha kumara
Hello Guys 

I added new language to django . language called Sinhala. My code is look 
like this.

On settings page 

LANGUAGE_CODE = 'en'
LANGUAGES = [
('si', _('Sinhala')),
('en', _('English')),
]
TIME_ZONE = 'UTC'

USE_I18N = True

USE_L10N = True

USE_TZ = True

LOCALE_PATHS = (
os.path.join(os.path.dirname(__file__), "../locale"),
)

On locale folder 

__init__.py

LANG_INFO = {
'si': {
'bidi': False,
'code': 'si',
'name': 'Sinhala',
'name_local': 'Sinhala',
},
}
I ran this command after that 

manage.py makemessages -l si
manage.py compilemessages


When i goes to admin URL with sinhala language its working fine i try get all 
supported language give this error 

{% csrf_token %}


{% get_current_language as LANGUAGE_CODE %}
{% get_available_languages as LANGUAGES %}
{% get_language_info_list for LANGUAGES as languages %}
{% for language in languages %}

{{ language.name_local }} ({{ language.code }})

{% endfor %}




-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/2f328be0-d237-4b02-b266-718891a06001%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: subhani_Django subject

2018-04-29 Thread lakshitha kumara
Hello Subhani 

Please look at this Example on github,

https://github.com/search?utf8=%E2%9C%93&q=django+example+&type=

Thanks

On Sunday, April 29, 2018 at 10:24:03 PM UTC+5:30, subhani shaik wrote:
>
> Hi friends...
>
> Can you please help me how to design web application using Django. can you 
> suggest me. i am soo may time trying to prepare.but errors are occured.so 
> plz give me sum example templates.
>
>
>
>
>
>
>
>
>
> Thank you
> subhani shaik
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/d7766247-545d-4c95-a398-1fe7bf5910cc%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: New language adding error('Unknown language code si.')

2018-04-30 Thread lakshitha kumara
Hello guys sorry this is the error.

KeyError at /accounts/login/

'Unknown language code si.'

Request Method: GET
Request URL: http://localhost.test:8000/accounts/login/
Django Version: 2.0.4
Exception Type: KeyError
Exception Value: 

'Unknown language code si.'

Exception Location: 
E:\HiveProject\DjangoWeb\lib\site-packages\django\utils\translation\__init__.py 
in get_language_info, line 244
Python Executable: E:\HiveProject\DjangoWeb\Scripts\python.exe
Python Version: 3.6.4
Python Path: 

['E:\\HiveProject\\DjangoWeb\\hive',
 'E:\\HiveProject\\DjangoWeb\\Scripts\\python36.zip',
 'E:\\HiveProject\\DjangoWeb\\DLLs',
 'E:\\HiveProject\\DjangoWeb\\lib',
 'E:\\HiveProject\\DjangoWeb\\Scripts',
 'c:\\python36\\Lib',
 'c:\\python36\\DLLs',
 'E:\\HiveProject\\DjangoWeb',
 'E:\\HiveProject\\DjangoWeb\\lib\\site-packages']

Server time: Mon, 30 Apr 2018 06:34:03 +
On Monday, April 30, 2018 at 7:47:45 AM UTC+5:30, lakshitha kumara wrote:
>
> Hello Guys 
>
> I added new language to django . language called Sinhala. My code is look 
> like this.
>
> On settings page 
>
> LANGUAGE_CODE = 'en'
> LANGUAGES = [
> ('si', _('Sinhala')),
> ('en', _('English')),
> ]
> TIME_ZONE = 'UTC'
>
> USE_I18N = True
>
> USE_L10N = True
>
> USE_TZ = True
>
> LOCALE_PATHS = (
> os.path.join(os.path.dirname(__file__), "../locale"),
> )
>
> On locale folder 
>
> __init__.py
>
> LANG_INFO = {
> 'si': {
> 'bidi': False,
> 'code': 'si',
> 'name': 'Sinhala',
> 'name_local': 'Sinhala',
> },
> }
> I ran this command after that 
>
> manage.py makemessages -l si
> manage.py compilemessages
>
>
> When i goes to admin URL with sinhala language its working fine i try get all 
> supported language give this error 
>
> {% csrf_token %}
> 
> 
> {% get_current_language as LANGUAGE_CODE %}
> {% get_available_languages as LANGUAGES %}
> {% get_language_info_list for LANGUAGES as languages %}
> {% for language in languages %}
>  LANGUAGE_CODE %} selected{% endif %}>
> {{ language.name_local }} ({{ language.code }})
> 
> {% endfor %}
> 
> 
> 
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/8c746d89-2e35-40a8-aa83-3dbf39bc872f%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: New language adding error('Unknown language code si.')

2018-04-30 Thread lakshitha kumara
Hello Jason,

*Thanks you for your reply but **unfortunately** that example not working 
any more with django 2 and python 3 .*


*Thanks*
On Monday, April 30, 2018 at 7:47:45 AM UTC+5:30, lakshitha kumara wrote:
>
> Hello Guys 
>
> I added new language to django . language called Sinhala. My code is look 
> like this.
>
> On settings page 
>
> LANGUAGE_CODE = 'en'
> LANGUAGES = [
> ('si', _('Sinhala')),
> ('en', _('English')),
> ]
> TIME_ZONE = 'UTC'
>
> USE_I18N = True
>
> USE_L10N = True
>
> USE_TZ = True
>
> LOCALE_PATHS = (
> os.path.join(os.path.dirname(__file__), "../locale"),
> )
>
> On locale folder 
>
> __init__.py
>
> LANG_INFO = {
> 'si': {
> 'bidi': False,
> 'code': 'si',
> 'name': 'Sinhala',
> 'name_local': 'Sinhala',
> },
> }
> I ran this command after that 
>
> manage.py makemessages -l si
> manage.py compilemessages
>
>
> When i goes to admin URL with sinhala language its working fine i try get all 
> supported language give this error 
>
> {% csrf_token %}
> 
> 
> {% get_current_language as LANGUAGE_CODE %}
> {% get_available_languages as LANGUAGES %}
> {% get_language_info_list for LANGUAGES as languages %}
> {% for language in languages %}
>  LANGUAGE_CODE %} selected{% endif %}>
> {{ language.name_local }} ({{ language.code }})
> 
> {% endfor %}
> 
> 
> 
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/055aee4e-5ff7-42fb-b6ad-7e40d967f760%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Username same as user id

2018-05-06 Thread lakshitha kumara
Hello guys 

Is there way to assign username same as user id if username passing empty 
value on registration form. is there way to do that.

Thanks

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/3b811612-a833-458a-bf37-801f09a1d998%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Username same as user id

2018-05-06 Thread lakshitha kumara
hi anthony 

Thank you for reply on this site username field not required field for 
user  but its set as required field on backend so i need assing user id as 
as username if username is empty for on registration submit. 
user can login with email phone and username 

Thanks 


On Sunday, May 6, 2018 at 8:13:55 PM UTC+5:30, lakshitha kumara wrote:
>
> Hello guys 
>
> Is there way to assign username same as user id if username passing empty 
> value on registration form. is there way to do that.
>
> Thanks
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/ed1f8b3c-301e-400c-b493-a55f49f2cdc5%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Username same as user id

2018-05-06 Thread lakshitha kumara
hi anthony 

Look at the facebook registration form. there are no username field first 
time user registration. but once user registered they can set username what 
they want. 

Thanks 

On Sunday, May 6, 2018 at 8:13:55 PM UTC+5:30, lakshitha kumara wrote:
>
> Hello guys 
>
> Is there way to assign username same as user id if username passing empty 
> value on registration form. is there way to do that.
>
> Thanks
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/e7eb07c0-6162-4c88-b5b4-8d1a5ee2d4b6%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Username same as user id

2018-05-06 Thread lakshitha kumara

Hello Jeni 

Thank you for your reply. yes i dealing with my own custom authentication 
backend and now i desided to use username as random number Instead of user 
id if username not set.

Thanks you

On Sunday, May 6, 2018 at 8:13:55 PM UTC+5:30, lakshitha kumara wrote:
>
> Hello guys 
>
> Is there way to assign username same as user id if username passing empty 
> value on registration form. is there way to do that.
>
> Thanks
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/a5474895-5676-449f-834f-4d3ab30594dd%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Authenticate with mobile number(duplicate mobile number)

2018-05-27 Thread lakshitha kumara
Hello guys

I have some issue in user Authenticate System for example there are tow 
country called X and Y this two country phone code is +9 and +10 (this is 
only for example) . this two country have two people name called R and M. R 
person mobile is +9123456789 and M person mobile number is +10123456789.

There are site called P and this two user come to register on that site and 
enter the mobile number. both people enter the mobile number without 
country code but this site get user country code via ip address.

But problem is if we save mobile number as what user enter mobile number 
field will be duplicate. and if save with country code user don't know 
about it and next time once he came and enter the same mobile number he 
entered before system will say invalid mobile number.

i would like to know best way bypass this method . most of websites have 
this issue.

Thanks

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/5c0d3b5b-e055-4106-9517-943d3d5594c3%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Authenticate with mobile number(duplicate mobile number)

2018-05-27 Thread lakshitha kumara
Hello Jason,

Thank you fro your suggestion. but thing is im getting mobile number like 
this .


<https://lh3.googleusercontent.com/-8bDMxu0gHVA/Wwt5VQv7iQI/BJU/P08zAXDnS5cEOnsV8I7Hr_lpdQy6q64IgCLcBGAs/s1600/dsadasW.jpg>
user can enter the email or mobile number. if user enter mobile number with 
country code that fine if not then i get user country code via ip and 
validate mobile number. then i save two first one is user enter mobile 
number. so it can with country code or without. the problem is if country 
code not there can be duplicate number i can save number with country code 
if user not enter the country code because next login user will not enter 
the country code so then that user cant login. 

look like i only option is saving mobile number with country code and once 
user enter the mobile number without country code then search db LIKE and 
if match with password login to the system.

Thanks

On Sunday, May 27, 2018 at 5:32:25 PM UTC+5:30, lakshitha kumara wrote:
>
> Hello guys
>
> I have some issue in user Authenticate System for example there are tow 
> country called X and Y this two country phone code is +9 and +10 (this is 
> only for example) . this two country have two people name called R and M. R 
> person mobile is +9123456789 and M person mobile number is +10123456789.
>
> There are site called P and this two user come to register on that site 
> and enter the mobile number. both people enter the mobile number without 
> country code but this site get user country code via ip address.
>
> But problem is if we save mobile number as what user enter mobile number 
> field will be duplicate. and if save with country code user don't know 
> about it and next time once he came and enter the same mobile number he 
> entered before system will say invalid mobile number.
>
> i would like to know best way bypass this method . most of websites have 
> this issue.
>
> Thanks
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/e94d3d85-8798-4aaf-817f-4a0a043e11c2%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Best way to make send email (email template with dynamic value)

2018-06-14 Thread lakshitha kumara
Hello Guys 

I would like to know best way to send email on django 2. email should have 
email template and dynamic value.

EmailMultiAlternatives or send_mail

And appreciate if good sample 


Thanks

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/39b40257-f3ce-4357-9c18-3bed8306fc20%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: New language adding error('Unknown language code si.')

2018-08-30 Thread lakshitha kumara
Hello Deniz Bazan

*I fixed that issue with override Django locale file. you can try to 
setting up file this your setting.py file *

*EXTRA_LANG_INFO = {*
*'si': {*
*'bidi': False,*
*'code': 'si',*
*'name': 'Sinhala',*
*'name_local': 'සිංහල',*
*},*
*'en': {'bidi': False,'code': 'en','name': 
'English','name_local': 'English',},*
*}*

On Thursday, August 9, 2018 at 9:01:58 PM UTC+5:30, Deniz Bazan wrote:
>
> Hi Kumara, did you  find a solution for your question, because i have same 
> problem. 
>
> Am Montag, 30. April 2018 14:04:01 UTC+2 schrieb lakshitha kumara:
>>
>> Hello Jason,
>>
>> *Thanks you for your reply but **unfortunately** that example not 
>> working any more with django 2 and python 3 .*
>>
>>
>> *Thanks*
>> On Monday, April 30, 2018 at 7:47:45 AM UTC+5:30, lakshitha kumara wrote:
>>>
>>> Hello Guys 
>>>
>>> I added new language to django . language called Sinhala. My code is 
>>> look like this.
>>>
>>> On settings page 
>>>
>>> LANGUAGE_CODE = 'en'
>>> LANGUAGES = [
>>> ('si', _('Sinhala')),
>>> ('en', _('English')),
>>> ]
>>> TIME_ZONE = 'UTC'
>>>
>>> USE_I18N = True
>>>
>>> USE_L10N = True
>>>
>>> USE_TZ = True
>>>
>>> LOCALE_PATHS = (
>>> os.path.join(os.path.dirname(__file__), "../locale"),
>>> )
>>>
>>> On locale folder 
>>>
>>> __init__.py
>>>
>>> LANG_INFO = {
>>> 'si': {
>>> 'bidi': False,
>>> 'code': 'si',
>>> 'name': 'Sinhala',
>>> 'name_local': 'Sinhala',
>>> },
>>> }
>>> I ran this command after that 
>>>
>>> manage.py makemessages -l si
>>> manage.py compilemessages
>>>
>>>
>>> When i goes to admin URL with sinhala language its working fine i try get 
>>> all supported language give this error 
>>>
>>> {% csrf_token %}
>>> 
>>> 
>>> {% get_current_language as LANGUAGE_CODE %}
>>> {% get_available_languages as LANGUAGES %}
>>> {% get_language_info_list for LANGUAGES as languages %}
>>> {% for language in languages %}
>>> >> LANGUAGE_CODE %} selected{% endif %}>
>>> {{ language.name_local }} ({{ language.code }})
>>> 
>>> {% endfor %}
>>> 
>>> 
>>> 
>>>
>>>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/7175788d-456f-4535-b8b6-ab63839a1005%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: New language adding error('Unknown language code si.')

2018-08-30 Thread lakshitha kumara
Hello Bazan

you can be fixed this issue this override Django locale file. setting up 
your settings.py file like the below.

EXTRA_LANG_INFO = {
'si': {
'bidi': False,
'code': 'si',
'name': 'Sinhala',
'name_local': 'සිංහල',
},
'en': {
'bidi': False,
'code': 'en',
'name': 'English',
'name_local': 'English',
},
}
LANG_INFO = dict(EXTRA_LANG_INFO.items())
django.conf.locale.LANG_INFO = LANG_INFO

LANGUAGE_CODE = 'en'
LANGUAGES = [
('en', _('English')),
('si', _('Sinhala')),
]

This one fixed the issue. should remember to add all language details your 
using to EXTRA_LANG_INFO variable 

Thanks

On Thursday, August 9, 2018 at 9:01:58 PM UTC+5:30, Deniz Bazan wrote:
>
> Hi Kumara, did you  find a solution for your question, because i have same 
> problem. 
>
> Am Montag, 30. April 2018 14:04:01 UTC+2 schrieb lakshitha kumara:
>>
>> Hello Jason,
>>
>> *Thanks you for your reply but **unfortunately** that example not 
>> working any more with django 2 and python 3 .*
>>
>>
>> *Thanks*
>> On Monday, April 30, 2018 at 7:47:45 AM UTC+5:30, lakshitha kumara wrote:
>>>
>>> Hello Guys 
>>>
>>> I added new language to django . language called Sinhala. My code is 
>>> look like this.
>>>
>>> On settings page 
>>>
>>> LANGUAGE_CODE = 'en'
>>> LANGUAGES = [
>>> ('si', _('Sinhala')),
>>> ('en', _('English')),
>>> ]
>>> TIME_ZONE = 'UTC'
>>>
>>> USE_I18N = True
>>>
>>> USE_L10N = True
>>>
>>> USE_TZ = True
>>>
>>> LOCALE_PATHS = (
>>> os.path.join(os.path.dirname(__file__), "../locale"),
>>> )
>>>
>>> On locale folder 
>>>
>>> __init__.py
>>>
>>> LANG_INFO = {
>>> 'si': {
>>> 'bidi': False,
>>> 'code': 'si',
>>> 'name': 'Sinhala',
>>> 'name_local': 'Sinhala',
>>> },
>>> }
>>> I ran this command after that 
>>>
>>> manage.py makemessages -l si
>>> manage.py compilemessages
>>>
>>>
>>> When i goes to admin URL with sinhala language its working fine i try get 
>>> all supported language give this error 
>>>
>>> {% csrf_token %}
>>> 
>>> 
>>> {% get_current_language as LANGUAGE_CODE %}
>>> {% get_available_languages as LANGUAGES %}
>>> {% get_language_info_list for LANGUAGES as languages %}
>>> {% for language in languages %}
>>> >> LANGUAGE_CODE %} selected{% endif %}>
>>> {{ language.name_local }} ({{ language.code }})
>>> 
>>> {% endfor %}
>>> 
>>> 
>>> 
>>>
>>>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/81891d8c-aec9-427f-8bc8-3cb35e387153%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: How to use Django with Reactjs

2018-10-01 Thread lakshitha kumara
Hello, Mohammad Ansari,

Yes, you can use Django and Reactjs together. 

you can use Django web pack loader.

https://github.com/owais/django-webpack-loader

On Tuesday, October 2, 2018 at 2:09:16 AM UTC+5:30, iammoham...@gmail.com 
wrote:
>
> Hi can we use Django with Reactjs without using api and what is ways for 
> using Django and Reactjs together?
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/91770fd5-0de6-4a88-ad3a-a20fed77142b%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Using Django middleware with web and mobile app

2018-11-12 Thread lakshitha kumara
Hello Guys,

I'm developing a mobile app and website with one Django backend. all web 
browser(mobile browser included) using session auth and mobile app using 
Rest API with OAuth 2 authentications.  I would like to know the best way 
to handle Django middleware with web and mobile app.

For example, there are using verification middleware. currently, I'm trying 
to do if user not verifies then redirect to the verification page but this 
method hard to handle mobile app.i cant check mobile device method also 
because of mobile also behaviour like a web browser.

one solution is using custom Django decorator 

Is there are any other solution for this method?

Thanks




-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/6087f0e9-7709-47ad-b50f-fe759fb72c4d%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.