Protect Django media files per user basis and also under NGINX

2021-04-19 Thread Tal Bar-Or
Hello, i have a project that create qrcode per user one to one relation, i discover that this media qr iame can be access if url is known . Can somone please help me with best practice to Protect Django media files per user basis and also under NGINX for later production Please advice Thank

Using Signals and method in models to automate key and qrcode>> help

2021-04-17 Thread Tal Bar-Or
Hello , i have a simple model that create additional one to one relation to User a profile like table with tables of pytop code and qrcode associated per user. I had success to create the pytop code ,but the qr code i have difficulty to achieve it since i need to get, The current users creat

Advice on self service password reset?

2021-02-26 Thread Tal Bar-Or
Hello , I would like to write self service password service for our organization , the identity source is our active directory. To accomplish this task i choose to use ldap3 library , reset password procedure would be simple template with enter your mail , backend will look for email user attri

Raw View class without form and model

2021-02-17 Thread Tal Bar-Or
Hello , I would like to write Raw view model for current scenario, i started writing portal for self service AD change password , the view for the change password is no need any model ,since it should be is using background ldap3 library , in addition i would like in a POST method to read th

Re: How to add css class and attribute to username,password

2021-02-14 Thread Tal Bar-Or
AM Omkar Parab wrote: > >> Install django-widget-tweaks package. >> >> On Mon, Feb 8, 2021, 2:11 AM Tal Bar-Or wrote: >> >>> >>> Hello , >>> >>> I writing project which the user login with my own customized HTML page >>> (boosstrap)

How can I use a Sync HTTP Consumer in Django Channels?

2021-02-08 Thread Tal
I'm using Channels v2. I want to integrate long-polling into my project. The only consumer I see in the documentation for http long polling is the AsyncHttpConsumer . The code I need to run in my handle function

How to add css class and attribute to username,password

2021-02-07 Thread Tal Bar-Or
Hello , I writing project which the user login with my own customized HTML page (boosstrap) i can manually add the form.username and form.password , but seems they don't get the attribute from my forms.py , dode is added below , please advise Thanks urls.py from django.urls import path f

Can we modify SQLCompiler to get a read-only model that selects from a subquery

2020-03-08 Thread Tal Perry
Hi, I'll start with some context so the question makes more sense. We run a multi-tenant SaaS where we use database multi-tenancy (one db per tenant). Part of offering is extensive and rather complex reporting, which is hard to do in the django ORM in a performant manner. The ability to use the

How to iterate over inlineformset_factory fields only?

2020-02-02 Thread Tal Bar-Or
Hello, I am trying to figure out how to access *inlineformset_factory* ,i set to represent my ForeignKey fields to present them in html i would like to iterate over those inlineformset_factory only in html, but i can't figure out how to achieve it, i can get display only field manually like

What's the best practice for securing static and media files from unauthenticated users?

2019-07-23 Thread Tal
I have a Django project, where, for the most part, users need to be logged in to see or do anything. If an unauthenticated user guesses a page name in my project, they would get redirected to the login page, with an error message, as they should. The project's static and media files on the othe

Re: SQLite 3.8.3 or later is required (found 3.7.17).

2019-07-19 Thread Tal
hing other than sqlite, you won't have this problem anymore. On Friday, July 19, 2019 at 2:08:50 PM UTC-6, Tal wrote: > > This is a known problem > <https://www.google.com/url?q=https%3A%2F%2Fcode.djangoproject.com%2Fticket%2F30313&sa=D&sntz=1&usg=AFQjCNFEZ2GRHkL_bqyMdSDy3

Re: Why am I getting multiple django error report emails for every exception?

2019-07-19 Thread Tal
o channels ASGI development server, it works fine, and I only get one email when an exception is thrown. On Friday, July 19, 2019 at 10:23:49 AM UTC-6, Tal wrote: > > I setup my django 2.2.3 project to use gmail to send emails out. > > I also have it configured to send me emails abo

Re: SQLite 3.8.3 or later is required (found 3.7.17).

2019-07-19 Thread Tal
This is a known problem - at least on CentOS 7. Not sure what OS you're running on AWS - I don't have much experience with AWS. I literally just ran into this

Re: Why do my django email error reports have weird characters in the subject?

2019-07-19 Thread Tal
re it. I guess it doesn't really bother me if it doesn't happen in production. On Friday, July 19, 2019 at 11:31:26 AM UTC-6, Tal wrote: > > Is this possibly related to the fact that I have django-channels enabled? > I'll try disabling it to see if it's related. >

Re: Why do my django email error reports have weird characters in the subject?

2019-07-19 Thread Tal
Is this possibly related to the fact that I have django-channels enabled? I'll try disabling it to see if it's related. On Friday, July 19, 2019 at 9:46:20 AM UTC-6, Tal wrote: > > I setup my django 2.2.3 project to use gmail to send emails out. > > I also have it config

Why am I getting multiple django error report emails for every exception?

2019-07-19 Thread Tal
I setup my django 2.2.3 project to use gmail to send emails out. I also have it configured to send me emails about any exceptions that occur. To test it, I made a view with: float('a') It works, but I'm getting 2 emails in my Gmail inbox every time I hit that view: [image: Screen Shot 2019-

Why do my django email error reports have weird characters in the subject?

2019-07-19 Thread Tal
I setup my django 2.2.3 project to use gmail to send emails out. I also have it configured to send me emails about any exceptions that occur. To test it, I made a view with: float('a') It works, but there are weird characters in the subject of the email I receive, and in the first part of t

Re: sqlite update on CentOS 7 for latest django version

2019-07-18 Thread Tal
b64/libsqlite3.so.0.8.6, and run "ldconfig" as root. I'll try to add this to the djangoproject ticket as well. Thanks On Thursday, July 18, 2019 at 9:07:50 AM UTC-6, Tal wrote: > > Yoo - this is a known problem. > <https://code.djangoproject.com/ticket/30313> It ha

Re: sqlite update on CentOS 7 for latest django version

2019-07-18 Thread Tal
to work. On Thursday, July 18, 2019 at 1:14:42 AM UTC-6, Jani Tiainen wrote: > > Hi. > > I think Python has built in version so you might need to build custom > version of python. > > Pyenv is pretty neat tool to handle custom python builds. > > ke 17. heinäk. 2019 klo 2

Re: sqlite update on CentOS 7 for latest django version

2019-07-17 Thread Tal
o use. On Wednesday, July 17, 2019 at 12:14:54 PM UTC-6, Tal wrote: > > When using the latest django from PyPI in CentOS 7, running "./manage.py > runserver" gives an error about sqlite being too old. > Since there's no newer sqlite version in the CentOS repos, I tried > b

sqlite update on CentOS 7 for latest django version

2019-07-17 Thread Tal
When using the latest django from PyPI in CentOS 7, running "./manage.py runserver" gives an error about sqlite being too old. Since there's no newer sqlite version in the CentOS repos, I tried building sqlite from scratch: curl -L https://www.sqlite.org/2019/sqlite-amalgamation-329.tar.gz >

What's the best way to have app access permissions?

2019-07-16 Thread Tal
I know you can have permissions on individual models that control which users have access to them, but I need something for my apps. Ex. If a user logs in, does he have access to the store_app? The forum_app? etc. I have a solution that looks something like this: models.py: class MyUser(Abstr

Game on Python

2019-06-25 Thread Ido Tal
a = input("p") p = 0 if a=="enis": print("correct!!!") p += 1 else : print("incorrect!!!") print("The Answer was penis") print("you have " + str( p ) + " points") b = input("d") if b=="ick": print("correct!!!") p += 1 else : print("incorrect!!!") print("The Ans

Re: What's the best way to inherit boolean values from a model?

2019-06-05 Thread Tal
an Ganji > +91-900-483-4183 > ganji...@gmail.com > http://ryucoder.in > > > On Wed, Jun 5, 2019 at 8:52 PM Tal > wrote: > >> Awesome! Simple and DRY. Thanks! >> >> On Wednesday, June 5, 2019 at 5:07:17 AM UTC-6, RyuCoder wrote: >>> >>> No nee

Re: What's the best way to inherit boolean values from a model?

2019-06-05 Thread Tal
255) > > > class CustomUser(BasePermissions, AbstractUser): > company = models.ForeignKey(Company, on_delete=models.CASCADE, > related_name="customuser") > > > > Cheers! > > > Regards, > Chetan Ganji > +91-900-483-4183 > ganji...@gmail.com > http://r

What's the best way to inherit boolean values from a model?

2019-06-04 Thread Tal
Lets say I have 2 models: class Company(models.Model): name = models.CharField(...) allow_blog_access = models.BooleanField(...) allow_shop_access = models.BooleanField(...) allow_admin_access = models.BooleanField(...) class User(AbstractUser): company = models.ForeignKey(Company, ...) .

Re: Static files in production [Was: How does WSGI work?]

2019-03-08 Thread Tal
tively, manage.py collectstatic will do that for you. > > > > > On Fri, 8 Mar, 2019, 5:29 AM Mike Dewhirst, > > <mailto:mi...@dewhirst.com.au >> wrote: > > > > On 8/03/2019 10:11 am, Tal wrote: > > > The word "simple" appears

Re: How does WSGI work?

2019-03-07 Thread Tal
The word "simple" appears 13 times in PEP, but no one knows how this magical specification works? Can anyone confirm I'm not crazy please? On Tuesday, February 26, 2019 at 3:13:00 PM UTC-7, Tal wrote: > > Is it right though? > > On Tuesday, February 26, 2019 at 2

Re: How does WSGI work?

2019-02-26 Thread Tal
Is it right though? On Tuesday, February 26, 2019 at 2:49:03 PM UTC-7, mike wrote: > > Great write up! > > On Tue, Feb 26, 2019 at 2:39 PM Tal > > wrote: > >> Did I get something wrong? >> Do you mean the devs working on the Django project know nothing about >

Re: How does WSGI work?

2019-02-26 Thread Tal
a conceptual understanding of what it is. On Tuesday, February 26, 2019 at 12:28:26 PM UTC-7, Motaz Hejaze wrote: > > You are very close to what realy happens , most of devs know nothing > aboutbthis stuff > > On Tue, 26 Feb 2019, 20:26 Tal, > wrote: > >> I've been developin

How does WSGI work?

2019-02-26 Thread Tal
I've been developing web applications using Flask and Django for about a year now, and although I've come across the term WSGI a bunch of times in both frameworks, I never really understood what it did. I'm sure I'm not the only one. The quick explanations I read never made sense to me. Even PE