Re: Using generators in Django

2019-12-18 Thread Mohit Solanki
If you only need to access object once while iterating then using iterators
 is a
better choice to reduce memory consumption, Generators won't help here as
soon this expression
```MyNeedsModel.filter(project_id=project_id).all()```  is evaluated the
all the rows will be fetched from the db at once and will be stored in the
queryset object, also about the code review comment, using generators won't
bypass django's inbuilt caching mechanism or something, I am not sure about
`integrator` maybe he/she meant `iterator`?

On Thu, Dec 19, 2019 at 12:03 PM onlinejudge95 
wrote:

> Hi Devs,
>
> A quick question. I am using Django to schedule some commands to populate
> my PostgreSQL(Apart from using it as a web framework). I am currently
> fetching records from a particular table and for each of those records
> doing some calculation and storing the processed data in some other
> database. The skeleton code looks like this
>
> ```
> ...
> def fetch_needs(project_id):
> for item in MyNeedsModel.filter(project_id=project_id).all():
> yield item
> ...
>
> class Command(django.core.management.base.BaseCommand):
> def add_argument(self, parser):
> ...
> def handler(self, *args, **kwargs):
> project = (args[0], args[1])
> project_id = MyProject.filter(...).id
> for need in fetch_needs(project_id):
> 
> ```
>
> I need to know whether the use of generators is correct here, in the sense
> that would it have any performance issues. The point that I am having
> trouble understanding is a comment on my code review.
>
> Also don’t use generator you are bypassing django inbuilt caching
>> mechanism. Using integrator it will create another list and get them one by
>> one
>
>
> Any help would be appreciated.
>
> Thanks,
> onlinejudge95
>
> --
> 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/CAD%3DM5eSsCtNGh_MFRX2DM6dY1nTmS8vehWWaQHqeH1Jfo1VujQ%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/CAKB6Ln-%3DT_JtsGE35giPLJsqX8KwZxWO1fEgF3sJXRatUAmfuA%40mail.gmail.com.


Using generators in Django

2019-12-18 Thread onlinejudge95
Hi Devs,

A quick question. I am using Django to schedule some commands to populate
my PostgreSQL(Apart from using it as a web framework). I am currently
fetching records from a particular table and for each of those records
doing some calculation and storing the processed data in some other
database. The skeleton code looks like this

```
...
def fetch_needs(project_id):
for item in MyNeedsModel.filter(project_id=project_id).all():
yield item
...

class Command(django.core.management.base.BaseCommand):
def add_argument(self, parser):
...
def handler(self, *args, **kwargs):
project = (args[0], args[1])
project_id = MyProject.filter(...).id
for need in fetch_needs(project_id):

```

I need to know whether the use of generators is correct here, in the sense
that would it have any performance issues. The point that I am having
trouble understanding is a comment on my code review.

Also don’t use generator you are bypassing django inbuilt caching
> mechanism. Using integrator it will create another list and get them one by
> one


Any help would be appreciated.

Thanks,
onlinejudge95

-- 
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/CAD%3DM5eSsCtNGh_MFRX2DM6dY1nTmS8vehWWaQHqeH1Jfo1VujQ%40mail.gmail.com.


django.urls.exceptions.NoReverseMatch

2019-12-18 Thread Chetan Rokade
Hi Friends,
getting below error :
"django.urls.exceptions.NoReverseMatch: Reverse for 'EditChange' not found. 
'EditChange' is not a valid view function or pattern name."

I have removed EditChange tag/string from all files in my project. 1) app 
level urls.py ,  2) views.py   3) base.html  4) app level changes.html 

still getting the same error. please help me.

-- 
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/67cadc7f-e82e-4971-8719-124d01414803%40googlegroups.com.


Re: manage.py not able to run any commands

2019-12-18 Thread Ian Githungo
First you have to check if you have activated your Visual environment which
you have installed Django

On Tue, Dec 17, 2019, 2:36 PM Phil Yang  wrote:

> Hi,
> All of a sudden, when I tried to run manage.py runserver, it didn't
> produce any output, and it didn't do anything. In fact, the manage.py
> script seems to not be able to run other commands, such as startapp or
> createsuperuser.
>
> I've already used the command many times prior, and it has always worked
> perfectly.
>
> Yes, Python is installed (I can run other scripts), but manage.py seems to
> have an 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 view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/c4b172e2-15a9-4fbf-96b6-e137086f614e%40googlegroups.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/CANW_d%2Bh4cJf9QD_CKOXsoHKryYuCHsiDUCnXybJy1%2BMJcbJniw%40mail.gmail.com.


Re: Necessary Precautions to be taken in Software to pass security Audit

2019-12-18 Thread Mike Dewhirst

On 19/12/2019 12:37 am, Balaji Shetty wrote:

Good Evening

 One query raised. My project is Government and it must pass through 
Security Audits. Company may be indian Government.


It was built in Django with Sqlite backend. It is hosted on 
Pythonanywhere. 90% work is accomplished in backend only.


Only report and graph display are in frontend.

My backend is Sqlite. Should I switch to Postgresql for security reason.


I prefer PostgreSQL for many reasons but like any DBMS it is only as 
secure as the machine on which it runs and the passwords and/or 
certificates with which you lock it down. It does have a setting 
"listen_addresses" which can also be locked down to an ACL of IP 
addresses if you wish.





What are additional precautions I must take to pass the audit for 
Software Approval


Is there any web site giving guidance.


--
Mr Shetty Balaji
Asst. Prof.
IT Department
SGGS I
Nanded. My. India

--
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/CAECSbOuPoODFfePd4iz1ZBPkBpcLQ6%3DkcR58KUuHrkc%3DCkMn5Q%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/698b06cf-80c3-2a60-d5e9-127ef774ef74%40dewhirst.com.au.


Re: TeenagerStartups looking for Project Interns for Django/React Project

2019-12-18 Thread Durai pandian
will people get paid? if not, you should hire a freelancer. Non-disclosure
agreement and confidentiality with all these things, not mentioning intern
stipend. It doesn't feel right.

On Thu, Dec 19, 2019 at 4:52 AM Roshan Shah  wrote:

>
> I am toying with idea of Teenager Startups and we just started development
> in Django 3.0 this week.
>
> This is entrepreneurship education platform for teenagers and we have a 5
> month MVP development roadmap.
>
> Anyone who wants to join this project as volunteer intern, please send
> request with the following
>
> 1) Your name and location
> 2) Your resume
> 3) Your availability in terms of daily hours
> 4) Your level of Django expertise
> 5) Your devops expertise
>
> We have daily standups at 9 AM EST via  zoom. You are expected to attend
> every standup and give status updates.
>
> We use Clickup for Project Mangement, Gitlab for Code Repo/CI/CD and slack
> for team communication. We log our time in Clockify.
>
> We are already in first week of development. You can also follow us on LI
> : http://www.linkedin.com/company/teenager-startups or facebook
> http://www.facebook.com/teenagerstartups.
>
> We have not yet registered this as entity but in mid March we will
> have more clarity if we will register this as Non Profit or Commercial
> Venture.
>
> Send resume to internshipsupp...@teenagerstartups.com
>
> Note : Preference will be given to those with Python/Django/React/HTML/CSS
> knowledge and those who can take this as a part of their academic project
> with university co-signing their agreement of Non Disclosure and other
> confidentiality terms, time commitment, etc.
>
> --
> --
>
> Roshan Shah
>
> This e-mail message may contain confidential or legally privileged
> information and is intended only for the use of the intended recipient(s).
> Any unauthorized disclosure, dissemination, distribution, copying or the
> taking of any action in reliance on the information herein is prohibited.
> E-mails are not secure and cannot be guaranteed to be error free as they
> can be intercepted, amended, or contain viruses. Anyone who communicates
> with me by e-mail is deemed to have accepted these risks.
>
> --
> 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/CALX19Ng%2Bzi9xcn5ei%3DOOfLdh0REt9fx7ZFLyypxEAviqi1Yp5g%40mail.gmail.com
> 
> .
>


-- 
Thanks & Regards,

*Durai pandianEmail: ddpa...@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/CAJsc%2Bob%3DmYdj469b73gnfrs708J771JfBqiB-5bHLR2_hxGYWg%40mail.gmail.com.


TeenagerStartups looking for Project Interns for Django/React Project

2019-12-18 Thread Roshan Shah
I am toying with idea of Teenager Startups and we just started development
in Django 3.0 this week.

This is entrepreneurship education platform for teenagers and we have a 5
month MVP development roadmap.

Anyone who wants to join this project as volunteer intern, please send
request with the following

1) Your name and location
2) Your resume
3) Your availability in terms of daily hours
4) Your level of Django expertise
5) Your devops expertise

We have daily standups at 9 AM EST via  zoom. You are expected to attend
every standup and give status updates.

We use Clickup for Project Mangement, Gitlab for Code Repo/CI/CD and slack
for team communication. We log our time in Clockify.

We are already in first week of development. You can also follow us on LI :
http://www.linkedin.com/company/teenager-startups or facebook
http://www.facebook.com/teenagerstartups.

We have not yet registered this as entity but in mid March we will
have more clarity if we will register this as Non Profit or Commercial
Venture.

Send resume to internshipsupp...@teenagerstartups.com

Note : Preference will be given to those with Python/Django/React/HTML/CSS
knowledge and those who can take this as a part of their academic project
with university co-signing their agreement of Non Disclosure and other
confidentiality terms, time commitment, etc.

-- 
-- 

Roshan Shah

This e-mail message may contain confidential or legally privileged
information and is intended only for the use of the intended recipient(s).
Any unauthorized disclosure, dissemination, distribution, copying or the
taking of any action in reliance on the information herein is prohibited.
E-mails are not secure and cannot be guaranteed to be error free as they
can be intercepted, amended, or contain viruses. Anyone who communicates
with me by e-mail is deemed to have accepted these risks.

-- 
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/CALX19Ng%2Bzi9xcn5ei%3DOOfLdh0REt9fx7ZFLyypxEAviqi1Yp5g%40mail.gmail.com.


Re: Can I perform calculations directly in django tags/filters?

2019-12-18 Thread Luqman Shofuleji
Try using django-mathfilters.

https://pypi.org/project/django-mathfilters/

On Wed, Dec 18, 2019, 11:55 PM Adeotun Adegbaju 
wrote:

> you should indicate which files codes should be added to
>
> On Tuesday, November 18, 2008 at 11:21:09 PM UTC+1, Daniel Roseman wrote:
>>
>> On Nov 18, 7:55 pm, jago  wrote:
>> > I am thinking about something like {{  (width - 5) *12  }}  ?
>>
>> No. You can add or subtract using the 'add' filter:
>> {{ width:add:"-5" }}
>> but anything else will require a custom template tag or filter.
>> Luckily, these are extremely easy to write:
>>
>> @register.filter
>> def multiply(value, arg}
>> return int(value) * int(arg)
>>
>> {{ width|multiply:12 }}
>>
>> You'll want to add error checking and so on of course, but that's the
>> idea.
>>
>> --
>> DR.
>
> --
> 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/3b901f38-024c-47b6-9794-c116b6d9913c%40googlegroups.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/CAHyB84oAnfmwOqZOu5gqhyGE%2BFa0Z49Nj2WRNCfide-5v2vaaw%40mail.gmail.com.


Re: Can I perform calculations directly in django tags/filters?

2019-12-18 Thread Adeotun Adegbaju
you should indicate which files codes should be added to

On Tuesday, November 18, 2008 at 11:21:09 PM UTC+1, Daniel Roseman wrote:
>
> On Nov 18, 7:55 pm, jago  wrote: 
> > I am thinking about something like {{  (width - 5) *12  }}  ? 
>
> No. You can add or subtract using the 'add' filter: 
> {{ width:add:"-5" }} 
> but anything else will require a custom template tag or filter. 
> Luckily, these are extremely easy to write: 
>
> @register.filter 
> def multiply(value, arg} 
> return int(value) * int(arg) 
>
> {{ width|multiply:12 }} 
>
> You'll want to add error checking and so on of course, but that's the 
> idea. 
>
> -- 
> DR.

-- 
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/3b901f38-024c-47b6-9794-c116b6d9913c%40googlegroups.com.


Re: Renaming sequences

2019-12-18 Thread Mike Dewhirst
Thanks Michael. It has been interesting so far and I'm looking forward to 
understanding what I've done
 Original message From: Michael MacIntosh 
 Date: 19/12/19  06:58  (GMT+10:00) To: 
django-users@googlegroups.com Subject: Re: Renaming sequences Hey Mike,I'm not 
sure about your specific setup, but I assume you are using the 
django.contrib.auth user model and are moving it over to your own app, and you 
have your own userprofile model that links to it.  The user model in 
django.contrib.auth is a swappable model.  Basically meaning as long as it 
inherits from a base class (I believe BaseUser) and you configure your settings 
(AUTH_USER_MODEL) to look at it, you should be fine, as long as you get the 
user model via get_user_model.A link to the documentation on 
thishttps://docs.djangoproject.com/en/3.0/topics/auth/customizing/#referencing-the-user-modelThe
 next section also goes into defining a custom user model.But in short there 
should be no ill-effects if you do everything right .Also if you are moving 
your own user model into your own app, I would recommend naming it something 
other than common, something containing auth, like "catapp_auth" so it is clear 
that your user models and any custom authorization / authentication happens in 
there.Hope that helps!Cheers,Michael.On 12/17/2019 10:26 PM, Mike Dewhirst 
wrote:> Are there any consequences for renaming sequences to match the tables > 
which own them?>> In an existing production Django project I have just 
converted > auth.user into common.user and company.userprofile into > 
common.userprofile.>> Having gone through the migration process more or less 
unscathed the > original sequences are owned by the renamed tables. Eg > 
public.auth_user_id_seq is owned by public.common_user.id>> Everything seems to 
work fine but my unit tests are playing up and > error messages are showing the 
original (and still correct) sequence > names. It would make much visual sense 
to me now and especially to the > future me (or anyone else) if the sequences 
were renamed as well.>> I know how I could do it but I just need to know if I 
should.>> Thanks for any advice>> Mike>-- 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/386eb4f4-6229-331f-05a5-c47d168db1fd%40linear-systems.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/5dfaa23e.1c69fb81.62e84.2852SMTPIN_ADDED_MISSING%40gmr-mx.google.com.


Re: Renaming sequences

2019-12-18 Thread Mike Dewhirst
I haven't touched production yet. Things seem ok in dev but I'm still asking 
around due to under-confidence. And it will be fully tested in staging before 
deploying live.
 Original message From: DANIEL URBANO DE LA RUA 
 Date: 19/12/19  07:07  (GMT+10:00) To: Django users 
 Subject: Re: Renaming sequences Why you did 
taht on production and not to try before recreate the db in other placeOn Wed, 
18 Dec 2019, 20:59 Michael MacIntosh,  wrote:Hey 
Mike,

I'm not sure about your specific setup, but I assume you are using the 
django.contrib.auth user model and are moving it over to your own app, 
and you have your own userprofile model that links to it.  The user 
model in django.contrib.auth is a swappable model.  Basically meaning as 
long as it inherits from a base class (I believe BaseUser) and you 
configure your settings (AUTH_USER_MODEL) to look at it, you should be 
fine, as long as you get the user model via get_user_model.

A link to the documentation on this
https://docs.djangoproject.com/en/3.0/topics/auth/customizing/#referencing-the-user-model

The next section also goes into defining a custom user model.

But in short there should be no ill-effects if you do everything right .

Also if you are moving your own user model into your own app, I would 
recommend naming it something other than common, something containing 
auth, like "catapp_auth" so it is clear that your user models and any 
custom authorization / authentication happens in there.

Hope that helps!

Cheers,
Michael.

On 12/17/2019 10:26 PM, Mike Dewhirst wrote:
> Are there any consequences for renaming sequences to match the tables 
> which own them?
>
> In an existing production Django project I have just converted 
> auth.user into common.user and company.userprofile into 
> common.userprofile.
>
> Having gone through the migration process more or less unscathed the 
> original sequences are owned by the renamed tables. Eg 
> public.auth_user_id_seq is owned by public.common_user.id
>
> Everything seems to work fine but my unit tests are playing up and 
> error messages are showing the original (and still correct) sequence 
> names. It would make much visual sense to me now and especially to the 
> future me (or anyone else) if the sequences were renamed as well.
>
> I know how I could do it but I just need to know if I should.
>
> Thanks for any advice
>
> Mike
>

-- 
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/386eb4f4-6229-331f-05a5-c47d168db1fd%40linear-systems.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/CAO_yRT2%3DGRDm-75XnVT%3DDs9Na3DtZMTVaMzQc9EHFv1VpeaUKQ%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/5dfaa1c9.1c69fb81.5d70e.24fcSMTPIN_ADDED_MISSING%40gmr-mx.google.com.


Re: Static files configuration

2019-12-18 Thread Kevin Dublin
Hey, try this:

In settings:

# If running collectstatic
STATIC_ROOT = os.path.join(BASE_DIR, 'staticfiles')

# make sure if you have multiple apps that you want to direct to specific
location of static files
STATIC_DIRS = (
os.path.join(BASE_DIR, '../apps/core/static'),
)

Finally if you're using Django 2.0+

In the html file:
{% load static %}


On Wed, Dec 18, 2019, 5:07 AM Yash Garg  wrote:

> I have to display a HTML page with its supporting css, js and images. So i
> create a template folder to put HTML in it then i create a static folder in
> which i create css, js and img folder and put related files into these
> folders.
> then I configure the
> *Settings.py*
>
> BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
>
> STATIC_URL = '/static/'
> MEDIA_ROOT = os.path.join(BASE_DIR, 'media')
>
> MEDIA_URL = '/media/'
>
> STATIC_ROOT = os.path.join(BASE_DIR, 'static')
>
> STATIC_DIRS = (
> os.path.join(BASE_DIR, 'static'),
> )
>
>
> *.html file *
>
> {% load staticfiles %}
> 
>
> *views.py*
>
> def Index(request):
> return render(request,'Teenager Startup.html')
>
> please help me where i'm not getting the point.
>
> --
> 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/68f02a87-1876-4d81-9cf7-daba5f9079ca%40googlegroups.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/CANips4KMEPxo-3P6-9L_q7s2mhgBRoMu5jJUj3c4a%2Be3FofLrw%40mail.gmail.com.


Re: Renaming sequences

2019-12-18 Thread DANIEL URBANO DE LA RUA
Why you did taht on production and not to try before recreate the db in
other place

On Wed, 18 Dec 2019, 20:59 Michael MacIntosh, 
wrote:

> Hey Mike,
>
> I'm not sure about your specific setup, but I assume you are using the
> django.contrib.auth user model and are moving it over to your own app,
> and you have your own userprofile model that links to it.  The user
> model in django.contrib.auth is a swappable model.  Basically meaning as
> long as it inherits from a base class (I believe BaseUser) and you
> configure your settings (AUTH_USER_MODEL) to look at it, you should be
> fine, as long as you get the user model via get_user_model.
>
> A link to the documentation on this
>
> https://docs.djangoproject.com/en/3.0/topics/auth/customizing/#referencing-the-user-model
>
> The next section also goes into defining a custom user model.
>
> But in short there should be no ill-effects if you do everything right .
>
> Also if you are moving your own user model into your own app, I would
> recommend naming it something other than common, something containing
> auth, like "catapp_auth" so it is clear that your user models and any
> custom authorization / authentication happens in there.
>
> Hope that helps!
>
> Cheers,
> Michael.
>
> On 12/17/2019 10:26 PM, Mike Dewhirst wrote:
> > Are there any consequences for renaming sequences to match the tables
> > which own them?
> >
> > In an existing production Django project I have just converted
> > auth.user into common.user and company.userprofile into
> > common.userprofile.
> >
> > Having gone through the migration process more or less unscathed the
> > original sequences are owned by the renamed tables. Eg
> > public.auth_user_id_seq is owned by public.common_user.id
> >
> > Everything seems to work fine but my unit tests are playing up and
> > error messages are showing the original (and still correct) sequence
> > names. It would make much visual sense to me now and especially to the
> > future me (or anyone else) if the sequences were renamed as well.
> >
> > I know how I could do it but I just need to know if I should.
> >
> > Thanks for any advice
> >
> > Mike
> >
>
> --
> 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/386eb4f4-6229-331f-05a5-c47d168db1fd%40linear-systems.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/CAO_yRT2%3DGRDm-75XnVT%3DDs9Na3DtZMTVaMzQc9EHFv1VpeaUKQ%40mail.gmail.com.


Re: Renaming sequences

2019-12-18 Thread Michael MacIntosh

Hey Mike,

I'm not sure about your specific setup, but I assume you are using the 
django.contrib.auth user model and are moving it over to your own app, 
and you have your own userprofile model that links to it.  The user 
model in django.contrib.auth is a swappable model.  Basically meaning as 
long as it inherits from a base class (I believe BaseUser) and you 
configure your settings (AUTH_USER_MODEL) to look at it, you should be 
fine, as long as you get the user model via get_user_model.


A link to the documentation on this
https://docs.djangoproject.com/en/3.0/topics/auth/customizing/#referencing-the-user-model

The next section also goes into defining a custom user model.

But in short there should be no ill-effects if you do everything right .

Also if you are moving your own user model into your own app, I would 
recommend naming it something other than common, something containing 
auth, like "catapp_auth" so it is clear that your user models and any 
custom authorization / authentication happens in there.


Hope that helps!

Cheers,
Michael.

On 12/17/2019 10:26 PM, Mike Dewhirst wrote:
Are there any consequences for renaming sequences to match the tables 
which own them?


In an existing production Django project I have just converted 
auth.user into common.user and company.userprofile into 
common.userprofile.


Having gone through the migration process more or less unscathed the 
original sequences are owned by the renamed tables. Eg 
public.auth_user_id_seq is owned by public.common_user.id


Everything seems to work fine but my unit tests are playing up and 
error messages are showing the original (and still correct) sequence 
names. It would make much visual sense to me now and especially to the 
future me (or anyone else) if the sequences were renamed as well.


I know how I could do it but I just need to know if I should.

Thanks for any advice

Mike



--
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/386eb4f4-6229-331f-05a5-c47d168db1fd%40linear-systems.com.


Django formset, forms passing unique choices into a choicefield for each form

2019-12-18 Thread Brad Allgood
Initially posted on stack overflow:

https://stackoverflow.com/questions/59395761/passing-dynamic-choices-into-a-formset-unique-for-each-form

I am working on what I thought was a simple college football confidence 
pool. The concept is as follows:

   - Bowl Model: Model that stores information of each bowl game being 
   played this season
   - Team Model: Model for all the teams playing in a bowl with a foreign 
   key to the bowl

models.py

from django.db import models
from django.contrib.auth.models import Group, User

class Bowl(models.Model):
"""Model for Bowl Game information"""
name = models.CharField(max_length=200)
b_date = models.DateField(null=True, blank=True)
b_time = models.TimeField(null=True, blank=True)
tv = models.CharField(max_length=10)
location = models.CharField(max_length=200)

def __str__(self):
"""String for representing the bowl object"""
return self.name

class Team(models.Model):
name = models.CharField(max_length=200)
bowl = models.ForeignKey(Bowl,on_delete=models.SET_NULL,null=True)

def __str__(self):
"""String for representing the intermediate table"""
return self.name   

I'm attempting to create a page has a formset which allows the user to pick 
the predicted winner of each game. Therefore I constructed the following 
view to call the form and formset.
views.py

   def fs_test(request):

   bowl_list = Bowl.objects.all()
   bowl_len = len(bowl_list)
   bowl_data = []

   TestFormSet = formset_factory(TestForm, extra=0)

   for bowl in bowl_list:
  bowl_data.append({
  't_bowl': bowl.name,'t_user':request.user,'t_weight':1,
  't_winner':winner_data,
  })

   if request.method == 'POST':
   pass
   else:
   formset = TestFormSet(initial=bowl_data)

   context = {
   'formset':formset, 'bowl_data':bowl_data
   }
   return render(request, 'catalog/test_bowl.html',context)

The following form inherits pre-populated data via passing "bowl_data" in 
the "initial" parameter.
forms.py

class TestForm(forms.Form):
 def __init__(self, *args, **kwargs):
 super(TestForm, self).__init__(*args, **kwargs)
 self.fields['t_bowl'] = forms.CharField()
 self.fields['t_weight'] = forms.IntegerField()
 self.fields['t_user'] = forms.CharField()
 self.fields['t_winner'] = forms.ChoiceField(
 widget=forms.RadioSelect,
 required=True,
 choices=[(o.name, o.name)
 for o in Team.objects.filter(bowl__name__exact=self.t_bowl)]
 )

I believe pre-populating the t_winner choices are failing because using the 
self.t_bowl in the query is just a field reference not the name of the 
field. I don't know how to pass in the "bowl" name to the form query. Or 
maybe I pre-populate the "choices" in the view but I don't know how to pass 
a dict into it and reference the correct index.

I've done some reading on the get_form_kwargs, but I'm not clear on how to 
use it in this instance.

It's entirely possible I'm using the wrong data model for this task, 
however I've been stumped for a couple of day on this. It took me a while 
to even figure out how to pass in unique "initial" values for each form in 
the formset.

Any recommendations would save what little hair I have left. Thank you!



-- 
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/0f19f3ef-7c5d-409c-98ab-150c07a196e1%40googlegroups.com.


Re: django orm filter queryset is returning empty

2019-12-18 Thread Dilraj sachdev
sounds like because some filters returning no results

On Tuesday, 17 December 2019 11:36:29 UTC, vignesh s wrote:
>
> django orm filter queryset is returning empty queryset and also checked in 
> the db the data is available
>

-- 
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/9bbb09c7-c77c-43c1-9867-7902c4d9b182%40googlegroups.com.


Django 3 + MySQL + User privilages in DB server

2019-12-18 Thread Wojciech Jędrzejczyk
I am going to create in Django new fornt-end (HTML + JS + CSS) to old 
application based on big MySQL database (lots of tables, views, stored 
procedures, logs, triggers and so on). I need to force Django to respect 
database privilage for each user. I know I can give in django some rights 
e.g. to the model or view but when I have table "customers" i want to give 
access to the user to few, selected customers from this table, not to all 
records. In another words: django has connection to MySQL by one django 
user and all users in django make operations on database tgough this django 
user. How can I force django to check user privilages in MySQL server ?

I have all the logic in database in stored procedures. I can add input 
parameter to each procedure {e.g. IN v_user char(50)} and django will call 
these procedures with this parameter. This will work very well but this 
solution does not provide security. I have invested a lot of time in 
learning django and I really like this framework. I have already prepared 
many html+css templates, I have bought theme from bootstrap. I am in the 
middle of my work but I cant continue until I find solution which will 
ensure that the user will have rights from the database.

Regards
Wojtek

-- 
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/d4abcf0c-9c44-4c14-9be3-ffaaa0212358%40googlegroups.com.


Re: how to display the number of views of an article with django

2019-12-18 Thread Awa M. Kinason
I have made some typo errors in typing: *view_count, *please just adjust 
that in the code. So it should be "*view_count*" anywhere i mistakenly 
wrote "*views_count*"

On Wednesday, December 18, 2019 at 4:25:33 PM UTC+1, JEAN MARLON MBAN wrote:
>
> how to display the number of views of an article with django
>
>

-- 
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/bbe31db6-2328-4a9f-9b07-6fdf5c4e7e41%40googlegroups.com.


Re: how to display the number of views of an article with django

2019-12-18 Thread Binoy U

Making the answer with the assumption that article is a modal.

You can add a field named count(PostiveIntegerField) and increment the 
count every time an article is viewed. I hope you have implemented article 
view as a DetailView or similar function view.

On Wednesday, December 18, 2019 at 4:25:33 PM UTC+1, JEAN MARLON MBAN wrote:
>
> how to display the number of views of an article with django
>
>

-- 
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/641a0661-0a46-43b2-b341-83f20ac694b0%40googlegroups.com.


Re: how to display the number of views of an article with django

2019-12-18 Thread Awa M. Kinason
First, add a column on the article Model named "views_count" 

Then on the DetailView of the article, and on the GET method. add this:

   
article.view_count += 1
article.save()


# or  (asuuming you are using class based views)

self.object.view_count += 1
self.object.save()


 


The problem with this method is that view_count will be updated each time 
the same person routes to that view or refreshes the page. To avoid this, 
you can add a list of 
counted articles in session. Something like


if 'counted_articles' not in session:
   session['counted_articles'] = []


# new line 
if self.object.id not in session['counted_articles']:
   session['counted_articles'].append(self.object.id)
   self.object.views_count += 1
   self.object.save()




This will ensure that for each session, the article is counted only once. 

hope that helps, if you have any questions, feel free to post them below. 

On Wednesday, December 18, 2019 at 4:25:33 PM UTC+1, JEAN MARLON MBAN wrote:
>
> how to display the number of views of an article with django
>
>

-- 
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/06d9c91a-a83e-45da-8c60-dc2380c216e9%40googlegroups.com.


how to display the number of views of an article with django

2019-12-18 Thread JEAN MARLON MBAN
how to display the number of views of an article with django

-- 
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/2de22d45-80d6-47a1-8b0b-c21a1fa5ca98%40googlegroups.com.


ImportError: DLL load failed: The specified module could not be found.

2019-12-18 Thread Mukesh Kalaga
Hello guys im a begginer in django.
I think i have issues in my virtual environment. when i run the other 
django project it works fine but when i run this project im having the 
following error op

 File "manage.py", line 21, in 
main()
  File "manage.py", line 17, in main
execute_from_command_line(sys.argv)
  File 
"E:\DjanjoWeb\acumen\env\lib\site-packages\django\core\management\__init__.py", 
line 401, in execute_from_command_line
utility.execute()
  File 
"E:\DjanjoWeb\acumen\env\lib\site-packages\django\core\management\__init__.py", 
line 377, in execute
django.setup()
  File "E:\DjanjoWeb\acumen\env\lib\site-packages\django\__init__.py", line 
24, in setup
apps.populate(settings.INSTALLED_APPS)
  File "E:\DjanjoWeb\acumen\env\lib\site-packages\django\apps\registry.py", 
line 114, in populate
app_config.import_models()
  File "E:\DjanjoWeb\acumen\env\lib\site-packages\django\apps\config.py", 
line 211, in import_models
self.models_module = import_module(models_module_name)
  File "C:\Users\kalag\Anaconda3\lib\importlib\__init__.py", line 127, in 
import_module
return _bootstrap._gcd_import(name[level:], package, level)
  File "", line 1006, in _gcd_import
  File "", line 983, in _find_and_load
  File "", line 967, in _find_and_load_unlocked
  File "", line 677, in _load_unlocked
  File "", line 728, in exec_module
  File "", line 219, in 
_call_with_frames_removed
  File 
"E:\DjanjoWeb\acumen\env\lib\site-packages\django\contrib\auth\models.py", 
line 2, in 
from django.contrib.auth.base_user import AbstractBaseUser, 
BaseUserManager
  File 
"E:\DjanjoWeb\acumen\env\lib\site-packages\django\contrib\auth\base_user.py", 
line 47, in 
class AbstractBaseUser(models.Model):
  File 
"E:\DjanjoWeb\acumen\env\lib\site-packages\django\db\models\base.py", line 
121, in __new__
new_class.add_to_class('_meta', Options(meta, app_label))
  File 
"E:\DjanjoWeb\acumen\env\lib\site-packages\django\db\models\base.py", line 
325, in add_to_class
value.contribute_to_class(cls, name)
  File 
"E:\DjanjoWeb\acumen\env\lib\site-packages\django\db\models\options.py", 
line 208, in contribute_to_class
self.db_table = truncate_name(self.db_table, 
connection.ops.max_name_length())
  File "E:\DjanjoWeb\acumen\env\lib\site-packages\django\db\__init__.py", 
line 28, in __getattr__
return getattr(connections[DEFAULT_DB_ALIAS], item)
  File "E:\DjanjoWeb\acumen\env\lib\site-packages\django\db\utils.py", line 
207, in __getitem__
backend = load_backend(db['ENGINE'])
  File "E:\DjanjoWeb\acumen\env\lib\site-packages\django\db\utils.py", line 
111, in load_backend
return import_module('%s.base' % backend_name)
  File "C:\Users\kalag\Anaconda3\lib\importlib\__init__.py", line 127, in 
import_module
return _bootstrap._gcd_import(name[level:], package, level)
  File 
"E:\DjanjoWeb\acumen\env\lib\site-packages\django\db\backends\sqlite3\base.py", 
line 14, in 
from sqlite3 import dbapi2 as Database
  File "C:\Users\kalag\Anaconda3\lib\sqlite3\__init__.py", line 23, in 

from sqlite3.dbapi2 import *
  File "C:\Users\kalag\Anaconda3\lib\sqlite3\dbapi2.py", line 27, in 

from _sqlite3 import *
ImportError: DLL load failed: The specified module could not be found.


can someone help me in resolving this issue


-- 
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/1bd4f51e-17da-42c8-a103-b30be0d05fd6%40googlegroups.com.


Re: manage.py can't run any commands

2019-12-18 Thread Ian Githungo
have you checked the virtual environment which you have installed the
version of Django you are currently using?


On Tue, Dec 17, 2019 at 2:36 PM Phil Yang  wrote:

> Hi,
> The manage.py script for all my projects has suddenly stopped working. It
> can't run any commands, such as runserver or startapp.
>
> Python is installed correctly; I have tested this with other scripts. I
> deleted Django and reinstalled, the problem still persists.
>
> Basically, whenever I run manage.py, there is no output.
>
> --
> 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/c0c868e0-f780-43c0-aced-a7d2bfffdaf0%40googlegroups.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/CANW_d%2BhThGL5csf3haf6t8hiG2%3DJqTJYOzi-JgvaENL_o8SdyA%40mail.gmail.com.


Re: Django Error - 'staticfiles' is not a registered tag library. Must be one of: admin_list admin_modify admin_urls

2019-12-18 Thread Balaji Shetty
Thank you very much everyone for help.My problem is solved with version
updates.

On Tuesday, December 17, 2019, Bilim Tr  wrote:

>
>
> 10 Aralık 2019 Salı 19:00:32 UTC+3 tarihinde Balaji yazdı:
>>
>> Hi
>>
>> I am getting error for every Project.
>>
>> I  created new environment and reinstalled python and Django.
>>
>> emplateSyntaxError at /
>>
>> 'staticfiles' is not a registered tag library. Must be one of:
>> admin_list
>> admin_modify
>> admin_urls
>> cache
>> i18n
>> l10n
>> log
>> propeller
>> static
>> tz
>>
>>
>>
>>
>> --
>>
>>
>> *Mr. Shetty Balaji S.Asst. ProfessorDepartment of Information Technology,*
>> *SGGS Institute of Engineering & Technology, Vishnupuri, Nanded.MH.India*
>> *Official: bssh...@sggs.ac.in *
>> *  Mobile: +91-9270696267*
>>
>> --
> 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/14b01579-1a10-463d-b9e4-bded2569cb9a%40googlegroups.com
> 
> .
>


-- 
Mr Shetty Balaji
Asst. Prof.
IT Department
SGGS I
Nanded. My. India

-- 
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/CAECSbOtkK5mWz8OjDr6tZJMkEfAppSXHtf%2Bo7CAc3QHjQJHsdA%40mail.gmail.com.


Re: seeking for explanations

2019-12-18 Thread Awa M. Kinason
I am a Django Developer, can work with you depending on the conditions of 
work. Checkout some of my works here: https://njanginetwork.com, 
https://billstack.net.

On Wednesday, December 18, 2019 at 2:08:57 PM UTC+1, Moise Sacko wrote:
>
> Hi. I want to create an hotel management project in django in which a 
> customer could, throught his dashboard rent a room online. Is someone who 
> could help me because I don't know how to start???
>

-- 
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/32ac3ab0-83c9-48f4-b1d6-876d35efc7fc%40googlegroups.com.


Necessary Precautions to be taken in Software to pass security Audit

2019-12-18 Thread Balaji Shetty
Good Evening


 One query raised. My project is Government and it must pass through
Security Audits. Company may be indian Government.

It was built in Django with Sqlite backend. It is hosted on Pythonanywhere.
90% work is accomplished in backend only.

Only report and graph display are in frontend.

My backend is Sqlite. Should I switch to Postgresql for security reason.


What are additional precautions I must take to pass the audit for Software
Approval

Is there any web site giving guidance.


-- 
Mr Shetty Balaji
Asst. Prof.
IT Department
SGGS I
Nanded. My. India

-- 
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/CAECSbOuPoODFfePd4iz1ZBPkBpcLQ6%3DkcR58KUuHrkc%3DCkMn5Q%40mail.gmail.com.


Re: Django security releases issued: 3.0.1, 2.2.9, and 1.11.27

2019-12-18 Thread אורי
Django developers,

We use Django 2.1 and anyway I saw that Django expects each user to have
one email address, where on Speedy Net each user can have multiple email
addresses. So I had to override *def save* in *class PasswordResetForm* on
Speedy Net:

https://github.com/speedy-net/speedy-net/blob/master/speedy/core/accounts/forms.py#L228-L279

I also added logging info to let us know who used the password reset form
and who received the password reset link.

I also checked and I noticed that if I reset the password of u...@speedy.net,
the email is sent to u...@speedy.net instead of u...@speedy.net - the email
is sent to the email the user submitted instead of the email the user has
on the database. This is a mistake. So I also updated the email to be sent
to the email the user has on the database - but the one matching the user
input and not just the primary email. So if a user has 2 email addresses,
and one stopped working, he can reset his password to the second email
address too, even if it's not his primary email address.

I decided to keep using Django 2.1 since there is still not a solution to
our Hebrew translation problem which I wrote you about in November.

Here is the code we use now (after I updated it today):

class PasswordResetForm(auth_forms.PasswordResetForm):
@property
def helper(self):
helper = FormHelperWithDefaults()
helper.add_input(Submit('submit', _('Submit')))
return helper

def get_users(self, email):
"""
Given an email, return matching user(s) who should receive a reset.
"""
email_addresses =
UserEmailAddress.objects.select_related('user').filter(email__iexact=email.lower())
return {e.user for e in email_addresses if ((e.email ==
email.lower()) and (e.user.has_usable_password()))}

def send_mail(self, subject_template_name, email_template_name,
context, from_email, to_email, html_email_template_name=None):
"""
Send a django.core.mail.EmailMultiAlternatives to `to_email`.
"""
send_mail(to=[to_email],
template_name_prefix='email/accounts/password_reset', context=context)

def save(self, domain_override=None,
subject_template_name='registration/password_reset_subject.txt',
email_template_name='registration/password_reset_email.html',
use_https=False, token_generator=default_token_generator,
from_email=None, request=None, html_email_template_name=None,
extra_email_context=None):
"""
Generate a one-use only link for resetting password and send
it to the user.
"""
email = self.cleaned_data["email"]
site = Site.objects.get_current()
users_list = self.get_users(email)
logger.info("PasswordResetForm::User submitted form,
site_name={site_name}, email={email},
matching_users={matching_users}".format(site_name=_(site.name),
email=email, matching_users=len(users_list)))
for user in users_list:
if not domain_override:
current_site = get_current_site(request)
site_name = current_site.name
domain = current_site.domain
else:
site_name = domain = domain_override
user_email_list = [e.email for e in
user.email_addresses.all() if (e.email == email.lower())]
if (len(user_email_list) == 1):
user_email = user_email_list[0]
logger.info("PasswordResetForm::Sending reset link to
the user, site_name={site_name}, user={user},
user_email={user_email}".format(site_name=_(site_name), user=user,
user_email=user_email))
context = {
'email': user_email,
'domain': domain,
'site_name': site_name,
'uid': urlsafe_base64_encode(force_bytes(user.pk)).decode(),
'user': user,
'token': token_generator.make_token(user),
'protocol': 'https' if use_https else 'http',
**(extra_email_context or {}),
}
self.send_mail(subject_template_name,
email_template_name, context, from_email, user_email,
html_email_template_name=html_email_template_name)
else:
logger.error("PasswordResetForm::User doesn't have a
matching email address, site_name={site_name}, user={user},
email={email}".format(site_name=_(site_name), user=user, email=email))


אורי
u...@speedy.net


On Wed, Dec 18, 2019 at 11:23 AM Mariusz Felisiak <
felisiak.mari...@gmail.com> wrote:

> Details are available on the Django project weblog:
>
> https://www.djangoproject.com/weblog/2019/dec/18/security-releases/
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django developers  (Contributions to Django itself)" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-developers+unsubscr...@googlegroups.com.
> To view this discussion on the web 

seeking for explanations

2019-12-18 Thread Moise Sacko
Hi. I want to create an hotel management project in django in which a 
customer could, throught his dashboard rent a room online. Is someone who 
could help me because I don't know how to start???

-- 
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/94d341f3-5d8a-43ff-a94a-670cba9a44c3%40googlegroups.com.


Static files configuration

2019-12-18 Thread Yash Garg
I have to display a HTML page with its supporting css, js and images. So i 
create a template folder to put HTML in it then i create a static folder in 
which i create css, js and img folder and put related files into these 
folders.
then I configure the
*Settings.py*

BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))

STATIC_URL = '/static/'
MEDIA_ROOT = os.path.join(BASE_DIR, 'media')

MEDIA_URL = '/media/'

STATIC_ROOT = os.path.join(BASE_DIR, 'static')

STATIC_DIRS = (
os.path.join(BASE_DIR, 'static'),
)


*.html file *

{% load staticfiles %}


*views.py*

def Index(request):
return render(request,'Teenager Startup.html')

please help me where i'm not getting the point.

-- 
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/68f02a87-1876-4d81-9cf7-daba5f9079ca%40googlegroups.com.


Django security releases issued: 3.0.1, 2.2.9, and 1.11.27

2019-12-18 Thread Mariusz Felisiak

Details are available on the Django project weblog:

https://www.djangoproject.com/weblog/2019/dec/18/security-releases/

--
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/87b42e7f-f80e-bd2b-6217-485b2fe41d37%40gmail.com.