Re: Language code issue - Django thinks default is en-us?

2023-07-21 Thread rezn...@gmail.com
Create a new middleware

from django.utils.translation import activate
from django.conf import settings


class CustomLanguageMiddleware:
def __init__(self, get_response):
self.get_response = get_response

def __call__(self, request):
# Read the language preference from the local storage cookie
language_preference = request.COOKIES.get('language_preference', 
None) # Instead of `None` set your default language code in case of there 
is no language_preference comes with cookies

# If a language preference is found, set the 'Accept-Language' 
header
if language_preference and language_preference in 
dict(settings.LANGUAGES):
request.META['HTTP_ACCEPT_LANGUAGE'] = language_preference

# Call the next middleware or view
response = self.get_response(request)

# If you want, you can also update the 'language' in the session
if language_preference and language_preference in 
dict(settings.LANGUAGES):
activate(language_preference)

return response


add it right before `django.middleware.locale.LocaleMiddleware` 

DJANGO_MIDDLEWARES = [
# add your custom middleware here
'django.middleware.locale.LocaleMiddleware',
]

this custom middleware will override the default behavior of the 
LocalMiddleware.

Finally, you can store the language preference in the local storage cookie:


const languagePreference = 'ru-RU'; // Replace this with the user's 
preferred language
localStorage.setItem('language_preference', languagePreference);


On Friday, June 20, 2014 at 7:22:53 PM UTC+6 Tom Evans wrote:

> On Fri, Jun 20, 2014 at 1:47 PM, Vernon D. Cole  
> wrote:
> > (*cough*)
> > Excuse me, everyone, but many of the locale names mentioned in this
> > discussion have been invalid.
> >
> > https://docs.djangoproject.com/en/1.6/topics/i18n/#term-locale-name 
> says:
> >>
> >> locale nameA locale name, either a language specification of the form ll
> >> or a combined language and country specification of the form ll_CC.
> >> Examples: it, de_AT, es, pt_BR. The language part is always in lower 
> case
> >> and the country part in upper case. The separator is an underscore.
> >
> >
> > so 'en-gb' should not be recognized.
> > 'en_GB' ought to be.
> >
>
> What is and what is not a locale name has little bearing on what is
> accepted and returned by django.utils.translation.{set,get}_language,
> which is self-evidently a language name.
>
> Language names map to locales.
>
> Cheers
>
> Tom
>

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/9e7717e6-7a63-48b3-9637-93b42c8f9349n%40googlegroups.com.


Re: Internship and job in python and Django related

2023-07-21 Thread Opeyemi Ajayi
I am Christiana Ajayi from Nigeria, but I am currently based in Rwanda and
Nigeria.  I have just concluded development of a realtime dashboard using
Django, Reactjs, HTML, CSS,  D3, PostgreSQL deployed on AWS cloud.

I also have an engineering  background and hold a Masters degree in
Engineering  Artificial Intelligence and Software engineering from Carnegie
Mellon University, and I am actively seeking remote/on-site part-time or
full-time opportunities that will help build on my skill in Django, Python,
Data Analytics and contribute to my professional growth.  I look forward
anyone who can accept me as a full time remote role anywhere in the world.
Thank you.

Attached is my LinkedIn profile: www.linkedin.com/in/opeyemichristianaajayi


Kind regards,
+250791591554
+2348133347565

On Wed, Jun 7, 2023, 4:17 PM Shubham DJ  wrote:

> Hello, I’m Shubhang Jori from Nerul Navi Mumbai. I have been learning web
> development for a few months now and have gained familiarity with Django,
> python , MySQL, HTML  and CSS. Also I have completed 3 months internship in
> trivia software as a python intern. As a student , I am actively seeking
> Full-time job opportunities as well as internship opportunities that will
> provide me with hands on experience in Django , python and contribute to my
> professional growth.  I look forward anyone who can accept me as a full
> time employee as well as an intern
>
>
> Also I attached resume for your reference.
> [image: PDF file]
> shubham cv-1-2.pdf
> 
>
> --
> 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 view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/CA%2B1KL_nGkLuktOc_3GEfDB1yzHCrovb_-rKJgT2trhsqnzn2rg%40mail.gmail.com
> 
> .
>

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAA0EoL37E%2BjkeUeggn%2BFoyisMtrp5OK-Du_xqO%2BHMQQW6tzLdg%40mail.gmail.com.


Re: Internship and job in python and Django related

2023-07-21 Thread Emmanuel Seth
Svp parlez en français 🙏🙏🙏


Le ven. 21 juil. 2023 à 15:14, Opeyemi Ajayi <
opeyemichristiana.aj...@gmail.com> a écrit :

> I am Christiana Ajayi from Nigeria, but I am currently based in Rwanda and
> Nigeria.  I have just concluded development of a realtime dashboard using
> Django, Reactjs, HTML, CSS,  D3, PostgreSQL deployed on AWS cloud.
>
> I also have an engineering  background and hold a Masters degree in
> Engineering  Artificial Intelligence and Software engineering from Carnegie
> Mellon University, and I am actively seeking remote/on-site part-time or
> full-time opportunities that will help build on my skill in Django, Python,
> Data Analytics and contribute to my professional growth.  I look forward
> anyone who can accept me as a full time remote role anywhere in the world.
> Thank you.
>
> Attached is my LinkedIn profile: www.linkedin.com/in/
> opeyemichristianaajayi
>
>
> Kind regards,
> +250791591554
> +2348133347565
>
> On Wed, Jun 7, 2023, 4:17 PM Shubham DJ  wrote:
>
>> Hello, I’m Shubhang Jori from Nerul Navi Mumbai. I have been learning web
>> development for a few months now and have gained familiarity with Django,
>> python , MySQL, HTML  and CSS. Also I have completed 3 months internship in
>> trivia software as a python intern. As a student , I am actively seeking
>> Full-time job opportunities as well as internship opportunities that will
>> provide me with hands on experience in Django , python and contribute to my
>> professional growth.  I look forward anyone who can accept me as a full
>> time employee as well as an intern
>>
>>
>> Also I attached resume for your reference.
>> [image: PDF file]
>> shubham cv-1-2.pdf
>> 
>>
>> --
>> 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 view this discussion on the web visit
>> https://groups.google.com/d/msgid/django-users/CA%2B1KL_nGkLuktOc_3GEfDB1yzHCrovb_-rKJgT2trhsqnzn2rg%40mail.gmail.com
>> 
>> .
>>
> --
> 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 view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/CAA0EoL37E%2BjkeUeggn%2BFoyisMtrp5OK-Du_xqO%2BHMQQW6tzLdg%40mail.gmail.com
> 
> .
>

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAMKrB%2B7AB-3aim3S-2meUQjtsOrWxwnx7pMKDhpmx4Lk7stpKw%40mail.gmail.com.


Re: Internship and job in python and Django related

2023-07-21 Thread Vishesh Mangla
You can use fixtures to store json data to your db but it should be in a
specific format based on your model.

On Fri, 21 Jul, 2023, 22:44 Emmanuel Seth, 
wrote:

> Svp parlez en français 🙏🙏🙏
>
>
> Le ven. 21 juil. 2023 à 15:14, Opeyemi Ajayi <
> opeyemichristiana.aj...@gmail.com> a écrit :
>
>> I am Christiana Ajayi from Nigeria, but I am currently based in Rwanda
>> and Nigeria.  I have just concluded development of a realtime dashboard
>> using Django, Reactjs, HTML, CSS,  D3, PostgreSQL deployed on AWS cloud.
>>
>> I also have an engineering  background and hold a Masters degree in
>> Engineering  Artificial Intelligence and Software engineering from Carnegie
>> Mellon University, and I am actively seeking remote/on-site part-time or
>> full-time opportunities that will help build on my skill in Django, Python,
>> Data Analytics and contribute to my professional growth.  I look forward
>> anyone who can accept me as a full time remote role anywhere in the world.
>> Thank you.
>>
>> Attached is my LinkedIn profile: www.linkedin.com/in/
>> opeyemichristianaajayi
>>
>>
>> Kind regards,
>> +250791591554
>> +2348133347565
>>
>> On Wed, Jun 7, 2023, 4:17 PM Shubham DJ 
>> wrote:
>>
>>> Hello, I’m Shubhang Jori from Nerul Navi Mumbai. I have been learning
>>> web development for a few months now and have gained familiarity with
>>> Django, python , MySQL, HTML  and CSS. Also I have completed 3 months
>>> internship in trivia software as a python intern. As a student , I am
>>> actively seeking Full-time job opportunities as well as
>>> internship opportunities that will provide me with hands on experience in
>>> Django , python and contribute to my professional growth.  I look forward
>>> anyone who can accept me as a full time employee as well as an intern
>>>
>>>
>>> Also I attached resume for your reference.
>>> [image: PDF file]
>>> shubham cv-1-2.pdf
>>> 
>>>
>>> --
>>> 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 view this discussion on the web visit
>>> https://groups.google.com/d/msgid/django-users/CA%2B1KL_nGkLuktOc_3GEfDB1yzHCrovb_-rKJgT2trhsqnzn2rg%40mail.gmail.com
>>> 
>>> .
>>>
>> --
>> 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 view this discussion on the web visit
>> https://groups.google.com/d/msgid/django-users/CAA0EoL37E%2BjkeUeggn%2BFoyisMtrp5OK-Du_xqO%2BHMQQW6tzLdg%40mail.gmail.com
>> 
>> .
>>
> --
> 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 view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/CAMKrB%2B7AB-3aim3S-2meUQjtsOrWxwnx7pMKDhpmx4Lk7stpKw%40mail.gmail.com
> 
> .
>

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CACaE8x7Pznmgqf_Ctho10pYmc1B82Q-FbBfkT5wWXTQ31osVCA%40mail.gmail.com.


DAILY,MONTHLY AND ANNUAL REPORTS

2023-07-21 Thread Abdou KARAMBIZI
Hello Friends,

How can I get weekly,Monthly and annual reports? from the following model.
I want to get the total amount paid in the week,month and year


class Payments(models.Model):
id = models.AutoField(primary_key = True)
amount = models.IntegerField()
paidon = models.DateField(auto_now=True)

def __str__ (self):
return self.id

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CABnE44wPtzkAL5YJ4uh3eRpupXUpH%3DkTJL71obTpTthorCdrTw%40mail.gmail.com.


Re: DAILY,MONTHLY AND ANNUAL REPORTS

2023-07-21 Thread Prashanth Patelc
Write a condition based on paidon date filed like filter date ,
If date is today get last 7days report and get last month report.

On Fri, Jul 21, 2023, 11:12 PM Abdou KARAMBIZI 
wrote:

> Hello Friends,
>
> How can I get weekly,Monthly and annual reports? from the following model.
> I want to get the total amount paid in the week,month and year
>
>
> class Payments(models.Model):
> id = models.AutoField(primary_key = True)
> amount = models.IntegerField()
> paidon = models.DateField(auto_now=True)
>
> def __str__ (self):
> return self.id
>
>
> --
> 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 view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/CABnE44wPtzkAL5YJ4uh3eRpupXUpH%3DkTJL71obTpTthorCdrTw%40mail.gmail.com
> 
> .
>

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAMCU6Co%2B8t1OZYAavf0CvhU6S9Boe2-%2B71fynpxiYWeiGDGijw%40mail.gmail.com.