Re: Help deciding ORM VS raw SQL trade-off in Complex scenario

2024-07-14 Thread eric paul
According to your scenario an accounting system is a more complex system
that requires high performance. It can be written in any language but as
the system grows some programming languages will experience performance
issues python being one of them take a case like Dropbox which was
originally written in python but because of python speeds and data handling
limitations it led the team to introduce other languages (Go, Rust) . Since
you've decided to go with Django then it's best you use raw queries and
concurrency etc inorder to achieve high performance.It also comes down to
your hardware and code practices . Take a look at the Django ledger repo an
accounting system. About the API you can explore Graphql.

On Sun, Jul 14, 2024, 8:48 PM Krishnakant Mane  wrote:

> Hi Eric.
>
> Can you explain a bit more on the "performance " aspect you refered to?
>
> I have already mentioned my scenario and given the case study which I am
> working on.
>
> In that reference, how using the ORM will benefit more than raw queries
> working with materialised views?
>
> Regarding security, I (and the team working on this ) are totally aware of
> the pitfalls and the way around them so that's out of the way.
>
> Regards.
>
>
> On 7/14/24 12:32, eric paul wrote:
>
> In whatever way possible use the Django ORM for security purposes and also
> efficiency . I won't recommend to use Raw queries if you don't know what
> you are doing
>
> On Sun, Jul 14, 2024, 7:34 AM Enock Deghost 
> wrote:
>
>> 
>>
>> On Sun, 14 Jul 2024, 6:15 am Krishnakant Mane, 
>> wrote:
>>
>>> Hello.
>>>
>>> I am seasoned SQLAlchemy user and quite good in node's sequelise ORM.
>>>
>>> But I am new to the one with Django.So here's my situation.
>>>
>>> I am developing an accounting (book keeping ) automation software
>>> service.
>>>
>>> So there are accounting rules (Debit = Dr and credit = Cr) for double
>>> entry book keeping.
>>>
>>> Every transaction will have 2 or more amounts, at least 1 each for dr or
>>> Cr.
>>>
>>> These entries are called vouchers.
>>>
>>> We also store retail bills, receipts and payments again all in different
>>> tables.
>>>
>>> But the bills and receipt tables are connected to the voucher
>>> table.
>>>
>>> The software generates reports such as cash flow, meaning day's opening
>>> balance, total Drs, total crs, and final closing balance (DRs - Crs).
>>>
>>> then there are Profit and Loss as well as balance sheet reports.
>>>
>>> All this needs a lot of aggregations (sum and counts ) and also joining
>>> of invoice + voucher and recept + voucher tables.
>>>
>>> so here are my questions.
>>>
>>> 1: given the fact that I have created materialised views in Postgresql,
>>> should I even care to model them and use the ORM syntax instead of raw
>>> query?  What would perform better?
>>>
>>> 2: datasets are going to be huge some times in terms of shear rows (all
>>> transactions aka vouchers ) or some times sum and count will be used in
>>> complex queries on a huge dataset.
>>>
>>> Again, should I rely on raw queries or will ORM plan the queries for me
>>> better?  Should I instead create stored procedures and call them from my
>>> REST API?
>>>
>>> talking of which,
>>>
>>> 3: I am using Django REST Framework and serialising records is an option
>>> to get json output.
>>>
>>> Should I use it or just go with raw queries and convert output to JSON
>>> as required?
>>>
>>> Again performance is a question.
>>>
>>> Tip, My team is very proficient in SQL and yours truely can modestly
>>> call himself an expert in the same, so maintenance is not an issue here.
>>>
>>> Regards.
>>>
>>> Krishnakant.
>>>
>>> --
>>> 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/097a6e55-c30e-491e-bf43-86e4c672faa4%40gmail.com
>>> .
>>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "Django users" group.
>> To unsubscribe from this group and stop re

Re: Help deciding ORM VS raw SQL trade-off in Complex scenario

2024-07-14 Thread eric paul
In whatever way possible use the Django ORM for security purposes and also
efficiency . I won't recommend to use Raw queries if you don't know what
you are doing

On Sun, Jul 14, 2024, 7:34 AM Enock Deghost  wrote:

> 
>
> On Sun, 14 Jul 2024, 6:15 am Krishnakant Mane, 
> wrote:
>
>> Hello.
>>
>> I am seasoned SQLAlchemy user and quite good in node's sequelise ORM.
>>
>> But I am new to the one with Django.So here's my situation.
>>
>> I am developing an accounting (book keeping ) automation software service.
>>
>> So there are accounting rules (Debit = Dr and credit = Cr) for double
>> entry book keeping.
>>
>> Every transaction will have 2 or more amounts, at least 1 each for dr or
>> Cr.
>>
>> These entries are called vouchers.
>>
>> We also store retail bills, receipts and payments again all in different
>> tables.
>>
>> But the bills and receipt tables are connected to the voucher
>> table.
>>
>> The software generates reports such as cash flow, meaning day's opening
>> balance, total Drs, total crs, and final closing balance (DRs - Crs).
>>
>> then there are Profit and Loss as well as balance sheet reports.
>>
>> All this needs a lot of aggregations (sum and counts ) and also joining
>> of invoice + voucher and recept + voucher tables.
>>
>> so here are my questions.
>>
>> 1: given the fact that I have created materialised views in Postgresql,
>> should I even care to model them and use the ORM syntax instead of raw
>> query?  What would perform better?
>>
>> 2: datasets are going to be huge some times in terms of shear rows (all
>> transactions aka vouchers ) or some times sum and count will be used in
>> complex queries on a huge dataset.
>>
>> Again, should I rely on raw queries or will ORM plan the queries for me
>> better?  Should I instead create stored procedures and call them from my
>> REST API?
>>
>> talking of which,
>>
>> 3: I am using Django REST Framework and serialising records is an option
>> to get json output.
>>
>> Should I use it or just go with raw queries and convert output to JSON
>> as required?
>>
>> Again performance is a question.
>>
>> Tip, My team is very proficient in SQL and yours truely can modestly
>> call himself an expert in the same, so maintenance is not an issue here.
>>
>> Regards.
>>
>> Krishnakant.
>>
>> --
>> 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/097a6e55-c30e-491e-bf43-86e4c672faa4%40gmail.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/CAA2jrmJ0TtbxmfXeSCq5S9p8XsrPjJBf6_gKMRY_MSuTagFt4Q%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/CALv%3Dr_nWJjrSk%3DLbFh-pfL5Ni%2B%2ByZu0qH%3DRU7o7mnpD-eJHcqw%40mail.gmail.com.


Django Model Image as background image in css

2024-05-11 Thread Paul Magadi
How do we use a model image as a background image for static css

-- 
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/985a602b-c154-4e91-ac65-f7da5d66adadn%40googlegroups.com.


Re: Freelance Opportunity : Django Developer for building A Dialer

2024-04-11 Thread Clinton Paul
hello is the position still available?

On Tue, Apr 2, 2024 at 8:19 PM Abhishek J 
wrote:

> Dear Developers,
>
> I need to build an android and IOS phone dialer similar to Truecaller.
>
> We are seeking experienced and dedicated candidates who are proficient in
> Django and possess a keen interest in contributing to this impactful
> initiative.
>
> We look forward to the opportunity to collaborate with talented
> individuals who are passionate about creating innovative solutions in the
> education sector.
>
> Thank you for considering this opportunity.
>
> --
> 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/CAKkngwDHBygGho4gkHRhNkpVJf_d2UOkHQ%3DemN3BtcFSVRU8sA%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/CABA3NGW%3DABUCrr0WFw7kPqsCAyYb3Qj7bnPA6%3D908am0GkuM7g%40mail.gmail.com.


Re: Redesign of agricultural project with python django and next.js technologies.

2024-02-19 Thread Paul Kirui
Hi I am also interested in contributing to this project. 
GitHub name: paul-kirui
My WhatsApp number :- +254710778763
On Monday 19 February 2024 at 09:50:10 UTC+3 Enamul Majid wrote:

> I'm interested to contribute in the project.
> WhatsApp: +8801917739840 <+880%201917-739840>
> Email: shift2unl...@gmail.com
>
> On Mon, 19 Feb 2024, 12:04 pm Amen Guda,  wrote:
>
>> I am very verry verry interested on this project; add me to the 
>> repository *amen...@gmail.com*
>>
>> On Mon, Feb 19, 2024 at 12:28 AM Code With Yusuf  
>> wrote:
>>
>>> I am interested; add me to the repository yusuf...@gmail.com
>>>
>>> On Sun, Feb 18, 2024 at 5:47 PM Jorge Bueno  
>>> wrote:
>>>
>>>> The project:
>>>>
>>>> I am working on an exciting project that I think you may be interested 
>>>> in. It is an online marketplace, similar to the US farmers and livestock 
>>>> markets, but with a strong online focus. The project is going to be redone 
>>>> from 0 I have a very detailed backlog . Contributing to this real-world 
>>>> project will allow you to learn a lot while working with modern and 
>>>> relevant technologies.
>>>>
>>>> Technologies:
>>>>
>>>> We are using Python and Django for the backend, and Next.js for the 
>>>> frontend.
>>>>
>>>> Why collaborate.
>>>>
>>>> Learn and grow: The project is well organized, providing the 
>>>> opportunity to work with cutting-edge technologies.
>>>> Impactful contribution: Your work will directly influence the success 
>>>> of the project.
>>>> Community involvement: Join our passionate team committed to project 
>>>> excellence.
>>>> How can you participate?
>>>>
>>>> I keep the repository private to avoid unnecessary distractions. Here's 
>>>> the link to the GitHub repository: 
>>>> https://github.com/Programacionpuntera/Marketplace-again. To add you, 
>>>> I will need your GitHub username. Also, I have created a WhatsApp group 
>>>> for 
>>>> the project. The more participants, the faster we will complete it! Feel 
>>>> free to share your phone number and I'll add you to the group. And just so 
>>>> you know exactly what I'm going to work on, I'm going to pass the entire 
>>>> backlog:
>>>> E-commerce Website Development Requirements:
>>>>
>>>> Backend (Python and Django):
>>>>
>>>>
>>>> User Registration:
>>>>
>>>> Create user models for farmers, ranchers, and consumers.
>>>> Define the necessary attributes for each type of user in the data model.
>>>> Implement CRUD (Create, Read, Update, Delete) functions for each user 
>>>> model.
>>>> Implement authentication by email or phone number and password.
>>>> Use a secure authentication library to store passwords securely.
>>>> Implement logic to verify the authenticity of emails or phone numbers.
>>>> Develop logic for user type selection and send verification emails or 
>>>> SMS.
>>>> Create a user interface to select the user type during registration.
>>>> Implement logic to send verification emails or SMS after registration.
>>>>
>>>>
>>>> User Profiles:
>>>>
>>>> Create models and views to store basic information and specific details 
>>>> for farmers, ranchers, and consumers.
>>>> Define the necessary attributes for each type of profile in the data 
>>>> model.
>>>> Implement CRUD (Create, Read, Update, Delete) functions for each 
>>>> profile model.
>>>> Create views to expose the profile data through an API.
>>>>
>>>>
>>>> Product Listings:
>>>>
>>>> Implement models and views for products.
>>>> Define the necessary attributes for each product in the data model.
>>>> Implement CRUD functions (Create, Read, Update, Delete) for the product 
>>>> model.
>>>> Create views to expose product data through an API.
>>>> Develop the logic for farmers and ranchers to publish products.
>>>> Implement logic to allow farmers and ranchers to publish new products.
>>>> Ensure that only authenticated users can publish products.
>>>>
>>>>
>>>> Search Engine and Filters:
>>>>
>>>> Implement a search engine that s

Re: Agricultural and livestock project using python, django and next technologies.

2024-02-19 Thread Paul Kirui
Hi I am interested in contributing to this project.

My WhatsApp number :- +254710778763
GitHub name :paul-kirui

On Sunday 18 February 2024 at 20:43:17 UTC+3 Jorge Bueno wrote:

> I wrote  about the same thing before but I only sent the title XD.
> The project:
>
> I'm working on an interesting project that I think might interest you. 
> This is an online market similar to farmers' and ranchers' markets in the 
> US, but with an online focus. The project is going to be redone from 
> scratch because I had many mistakes when I made the MVP, I have a very 
> specific backlog on how to do everything.
>
> Technologies:
>
> We are using Python and Django for the backend, and Next.js for the 
> frontend.
>
>
>
>
> Why collaborate:
>
> You will learn a lot - the project is well organized and will allow you to 
> work with modern and relevant technologies.
> You will contribute to a real project: Your work will have a direct impact 
> on the success of the project.
> You will be part of a community: We are a passionate team committed to the 
> success of the project.
> How can you participate?
> I keep the repository private because I don't like people gossiping: 
> https://github.com/Programacionpuntera/Marketplace-again
> so I will need to know your github user to add you. I have also created a 
> WhatsApp group to synchronize on pending tasks.
>

-- 
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/4be86fc1-5726-429b-b4bc-2d0955b72407n%40googlegroups.com.


SimpleJWT and Oauth

2023-12-13 Thread attah paul
Hello  I'm currently using SimpleJWT in my DRF API can i merge SimpleJWT 
with OAuth or any other Auth liberties for Social login

-- 
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/78b427bd-a489-41fc-8047-b80f653457c2n%40googlegroups.com.


Django 5.0

2023-12-13 Thread attah paul
any review on the Django from you guys 

-- 
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/13e60dfb-7683-4944-b36f-18fe0f52c320n%40googlegroups.com.


Re: Suggestions for Reducing Spam

2023-06-18 Thread Paul Kudla



a django jobs posting group would probably be best

i admit i have used this group for looking for professional help etc but 
always move off to the side if someone respond's


i too have seen recently google looking for programmers etc which has 
nothing to do with this group ??


fyi



Happy Sunday !!!
Thanks - paul

Paul Kudla


Scom.ca Internet Services <http://www.scom.ca>
004-1009 Byron Street South
Whitby, Ontario - Canada
L1N 4S3

Toronto 416.642.7266
Main 1.866.411.7266
Fax 1.888.892.7266
Email p...@scom.ca

On 6/18/2023 12:04 PM, Abhishek Choudhury wrote:

Hi Django User Group Admins,

I hope this email finds you well.

I'm writing this to discuss the recent influx of spam emails in our 
group. As we know, this group is a great resource for Django developers 
to learn, share, and collaborate. However, in the past few months, we've 
seen an increase in emails that are unrelated to Django, such as job 
postings and promotional materials.


I understand that some people may want to use the group to post job 
listings, but I believe that these emails are disruptive and detract 
from the purpose of the group. I've also noticed that some people are 
responding to these emails, which only encourages more spam.


I've been thinking about ways to address this issue, and I have a few 
ideas. One idea is to create a separate Google group for job postings. 
This would allow people who are looking for jobs to connect with each 
other, while keeping the Django_users group focused on Django-related 
content.


Another idea is to develop a Zapier + OpenAI plugin that can detect the 
type of email (sentiment analysis) and then mark it as spam or 
non-Django related, add automated reply and mute it. This would help to 
automatically filter out spam emails, so that they don't clutter up our 
group's inbox.


I'm not sure which of these ideas is the best solution, but I wanted to 
get your thoughts on the matter. What do you think about the recent 
influx of spam emails in our group? Do you have any suggestions for how 
we can address this issue?


I'm happy to help in any way I can. Please let me know if you have any 
questions.


Thank you for your time.

With kind regards,
Abhishek Choudhury

--
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 
<mailto:django-users+unsubscr...@googlegroups.com>.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CA%2B3kJUaoGRXy47q6wUFyYtn4u3YO1rm1gZJR4rYNcEXizxEnOg%40mail.gmail.com <https://groups.google.com/d/msgid/django-users/CA%2B3kJUaoGRXy47q6wUFyYtn4u3YO1rm1gZJR4rYNcEXizxEnOg%40mail.gmail.com?utm_medium=email_source=footer>.


--
This message has been scanned for viruses and
dangerous content by *MailScanner* <http://www.mailscanner.info/>, and is
believed to be clean.


--
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/57363a7d-547a-b3f6-ca90-79db4aaa9272%40scom.ca.


Re: got url error in app/urls.py file

2023-06-06 Thread Paul Haguet
It's extremely basic error... File urls.py line 3 the import is invalid as 
it say into the trace.

cretae??? Where is this function? I think "create" is the good function 
name: canno't import name crétin from 'audio_api.views...

Le mardi 6 juin 2023 à 14:15:25 UTC+2, AKHIL KORE a écrit :

> I'm creating my assignment django project. When I make migration with the 
> command of python manage.py makemigrations. I got a name_error in the 
> urls.py file. Please help me to remove that error.
>
> The files I mentioned below are .
> 1). views(1) & views(2) are views.py files.
> 2). urls file 
> 3). error on cmd file
>

-- 
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/b8d057b6-329b-4dc9-b275-771f32ebba95n%40googlegroups.com.


Re: uwsgi

2023-06-05 Thread Paul Haguet
I like uwsgi because it run natively for example: "service uwsgi start" on 
Debian
Then I don't like how supervisor manage the environement vars.

Notice if you want to use supervisor I suggest you to use dotenv 
library: https://pypi.org/project/python-dotenv/

Le dimanche 4 juin 2023 à 22:14:31 UTC+2, Larry Martell a écrit :

> I normally deploy my django apps using nginx and uwsgi. I recently
> found that the uwsgi mailing list is defunct, and I read this on the
> uwsgi github page:
>
> Note: The project is in maintenance mode (only bugfixes and updates
> for new languages apis). Do not expect quick answers on github issues.
>
> Are folks still deploying new apps with uwsgi, or have people switched
> to Gunicorn or something else?
>

-- 
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/169e1c52-b04b-4b21-8c31-cfbcfebd3e83n%40googlegroups.com.


Django dpahne prod

2023-06-05 Thread Paul Haguet
Hello everyone, I'am looking to deploy Django ASGI project in production.

This is the actual setup. Because Daphne is installed into the project 
python manage.py runserver use the asgi.py file instead of wsgi.

Si with this config the project run with asgi on port 8000 and wsgi on port 
5000.

Is there any big difference using

daphne -b 0.0.0.0 -p 8000 main.asgi:application

Instead of:
python manage.py runserver

[uwsgi]

uid = www-data
gid = www-data
socket  = 0.0.0.0:5000

for-readline= /srv/settings.env
env = %(_)
endfor  =

plugin  = python3
chdir   = /var/www/application
module  = main.wsgi:application

virtualenv  = /srv/env
daemonize   = /var/log/uwsgi/uwsgi_worker.log

attach-daemon = sh -c "cd /var/www/application/ ; source 
/srv/env/bin/activate && python manage.py runserver 0.0.0.0:8000"
attach-daemon = sh -c "cd /var/www/application/ ; source 
/srv/env/bin/activate && python manage.py qcluster"

-- 
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/5fc9c244-b593-46d4-8fe8-734269936c52n%40googlegroups.com.


Re: Unpaid Internship

2023-04-30 Thread Paul Kudla (SCOM.CA Internet Services Inc.)



sorry for using the list

John Diginee

please see scom.ca for my info



Happy Sunday !!!
Thanks - paul

Paul Kudla


Scom.ca Internet Services <http://www.scom.ca>
004-1009 Byron Street South
Whitby, Ontario - Canada
L1N 4S3

Toronto 416.642.7266
Main 1.866.411.7266
Fax 1.888.892.7266
Email p...@scom.ca

On 2023-04-24 10:26 a.m., John Diginee wrote:

Dear Sir/Ma'am,

I hope this message finds you well. I am a full-stack software 
engineering student at Holberton School, a Silicon Valley-based software 
engineering institution. I am reaching out to express my interest in an 
unpaid backend intern or junior role at your esteemed company.


My primary goal is to learn from your inspiring and experienced 
developers and gain practical, real-world experience. I am not 
particularly concerned about financial compensation at this time.


I understand that my request may seem unconventional, but I would be 
grateful for any opportunity to work with your company. I am a 
hardworking, persistent, determined, resilient, and fast-learning 
individual, and I am confident that I can contribute positively to your 
team.


Here's my LinkedIn and GitHub profile for your review:
https://www.linkedin.com/in/johndiginee/
https://github.com/johndiginee

  Thank you for your precious time and consideration. I look forward to 
hearing from 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 
<mailto:django-users+unsubscr...@googlegroups.com>.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/d0247416-15e7-42c2-bf56-54ef95bb6733n%40googlegroups.com <https://groups.google.com/d/msgid/django-users/d0247416-15e7-42c2-bf56-54ef95bb6733n%40googlegroups.com?utm_medium=email_source=footer>.


--
This message has been scanned for viruses and
dangerous content by *MailScanner* <http://www.mailscanner.info/>, and is
believed to be clean.


--
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/2ca3fe77-2fe1-a0c8-22f9-4ca678ce1b49%40scom.ca.


Re: Unpaid Internship

2023-04-30 Thread Paul Kudla (SCOM.CA Internet Services Inc.)



ok please see scom.ca for contact info

did not realize email was blocked by django users list




Happy Sunday !!!
Thanks - paul

Paul Kudla


Scom.ca Internet Services <http://www.scom.ca>
004-1009 Byron Street South
Whitby, Ontario - Canada
L1N 4S3

Toronto 416.642.7266
Main 1.866.411.7266
Fax 1.888.892.7266
Email p...@scom.ca

On 2023-04-24 10:26 a.m., John Diginee wrote:

Dear Sir/Ma'am,

I hope this message finds you well. I am a full-stack software 
engineering student at Holberton School, a Silicon Valley-based software 
engineering institution. I am reaching out to express my interest in an 
unpaid backend intern or junior role at your esteemed company.


My primary goal is to learn from your inspiring and experienced 
developers and gain practical, real-world experience. I am not 
particularly concerned about financial compensation at this time.


I understand that my request may seem unconventional, but I would be 
grateful for any opportunity to work with your company. I am a 
hardworking, persistent, determined, resilient, and fast-learning 
individual, and I am confident that I can contribute positively to your 
team.


Here's my LinkedIn and GitHub profile for your review:
https://www.linkedin.com/in/johndiginee/
https://github.com/johndiginee

  Thank you for your precious time and consideration. I look forward to 
hearing from 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 
<mailto:django-users+unsubscr...@googlegroups.com>.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/d0247416-15e7-42c2-bf56-54ef95bb6733n%40googlegroups.com <https://groups.google.com/d/msgid/django-users/d0247416-15e7-42c2-bf56-54ef95bb6733n%40googlegroups.com?utm_medium=email_source=footer>.


--
This message has been scanned for viruses and
dangerous content by *MailScanner* <http://www.mailscanner.info/>, and is
believed to be clean.


--
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/1b7d8dd5-5ea1-e483-ff64-7e77e3e448ee%40scom.ca.


Re: Unpaid Internship

2023-04-24 Thread Paul Kudla ( SCOM )
Pls contact me directly at p...@scom.ca please have an idea


   
thanks - paul 
   Paul Kudla  SCOM.CA Internet Services Inc.004-1009 Byron Street 
South   Whitby, Ontario - Canada   L1N 4S3Toronto   416.642.7266   Main   
1.866.411.7266   Fax   1.888.892.7266   

On Apr 24, 2023 at 10:26:17 EDT, John Diginee  
wrote:

 Dear Sir/Ma'am,I hope this message finds you well. I am a full-stack 
software engineering student at Holberton School, a Silicon Valley-based 
software engineering institution. I am reaching out to express my interest in 
an unpaid backend intern or junior role at your esteemed company.My primary 
goal is to learn from your inspiring and experienced developers and gain 
practical, real-world experience. I am not particularly concerned about 
financial compensation at this time.I understand that my request may seem 
unconventional, but I would be grateful for any opportunity to work with your 
company. I am a hardworking, persistent, determined, resilient, and 
fast-learning individual, and I am confident that I can contribute positively 
to your team.Here's my LinkedIn and GitHub profile for your review: 
https://www.linkedin.com/in/johndiginee/
https://github.com/johndiginee
  
 
  Thank you for your precious time and consideration. I look forward to hearing 
from 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/d0247416-15e7-42c2-bf56-54ef95bb6733n%40googlegroups.com
 .

-- 
This message has been scanned for viruses and
dangerous content by  MailScanner  , and is
believed to be clean.
 

-- 
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/94938A57-A4DB-4AF7-9C36-C59A2A3C8ED5.goodhumans%40scom.ca.


Re: Django Admin

2023-03-13 Thread Paul Kudla



ok hope i am not adding to the confusion

I ran into this a while back

CSRF errors are usually (in my case anyways) triggered by apache SSL 
setup etc


if you are running Apache + SSL you need to make sure the certificates 
and the SNI ssl naming is setup correctly or the CSRF errors will 
trigger randomly.


of course the ssl cert has to match the site name

this config assumes APACHE + WSGI + SSL etc. and you are running 
multiple virtual sites under apache.


Also note the port 80 redirect (ie everything is directed to the SSL site)

if you are mixing ssl & non-ssl apache / django will get confused and 
trip the CSRF error as well.


relative apache config (httpd.conf):


SSLRandomSeed startup builtin
SSLRandomSeed connect builtin

SSLSessionCache memcache:localhost:11211  <<-- only if using memcache.



then my apache config for a site ?

admin.scom.ca ?


ServerName admin.scom.ca
ServerAlias admin.scom.ca
Redirect permanent / https://admin.scom.ca/



ServerName admin.scom.ca
ServerAlias admin.scom.ca
DocumentRoot /www/admin.scom.ca

Alias /media/ /www/admin.scom.ca/media/
Alias /static/ /www/admin.scom.ca/statics/
Alias /statics/ /www/admin.scom.ca/statics/


  Options FollowSymLinks
  AllowOverride None
  Require all granted


SSLEngine on
SSLProtocol all
SSLCertificateFile /www/admin.scom.ca/ssl/admin.scom.ca.crt
SSLCertificateKeyFile /www/admin.scom.ca/ssl/admin.scom.ca.key
SSLCertificateChainFile /www/admin.scom.ca/ssl/admin.scom.ca.chain



SuexecUserGroup www www

##Below only used if running WSGI##

WSGIDaemonProcess adminscomcassl user=www group=www processes=10 threads=20
WSGIProcessGroup adminscomcassl
WSGIApplicationGroup %{GLOBAL}
WSGIImportScript /www/admin.scom.ca/django.wsgi 
process-group=adminscomcassl application-group=%{GLOBAL}


WSGIScriptAlias / /www/admin.scom.ca/django.wsgi

##End of WSGI##


SecFilterEngine Off
SecFilterScanPOST Off




Order Deny,Allow
Deny from All




php_admin_value open_basedir /www/admin.scom.ca:/var/log/



php_admin_value sys_temp_dir /www/admin.scom.ca/tmp/



php_admin_value session.save_path /www/admin.scom.ca/tmp/



php_admin_value soap.wsdl_cache_dir /www/admin.scom.ca/tmp/



php_admin_value upload_tmp_dir /www/admin.scom.ca/tmp



AllowOverride All
php_value session.save_path "/www/admin.scom.ca/"










Happy Monday !!!
Thanks - paul

Paul Kudla


Scom.ca Internet Services <http://www.scom.ca>
004-1009 Byron Street South
Whitby, Ontario - Canada
L1N 4S3

Toronto 416.642.7266
Main 1.866.411.7266
Fax 1.888.892.7266
Email p...@scom.ca

On 3/12/2023 5:44 AM, Muhammad Juwaini Abdul Rahman wrote:

I think you need to add the following in settings.py:

CSRF_TRUSTED_ORIGIN = ('')



On Sun, 12 Mar 2023 at 02:04, James Hunt <mailto:newbypass...@gmail.com>> wrote:


Hi there. I am fairly new to Django but have had previous success
with creating an app and being able to access the Admin page.
Recently, if I attempt to access the admin page of a new Django app
it throws the CSRF error upon trying to log in!!!

I have attempted several ways to bypass this error including adding
allowed hosts but I cant seem to get past this issue.

Can someone please provide me with the definitive way of stopping
CSRF error when simply trying to access the admin part of Django? I
mean there are no post functions that really apply to this feature
so I cant understand the CSRF token.

I cant get past this issue which means I can never access the admin
page!!

Please help.

Regards

James

-- 
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
<mailto:django-users+unsubscr...@googlegroups.com>.
To view this discussion on the web visit

https://groups.google.com/d/msgid/django-users/e13c7765-831e-45c5-b091-c8fcfbed19c5n%40googlegroups.com
 
<https://groups.google.com/d/msgid/django-users/e13c7765-831e-45c5-b091-c8fcfbed19c5n%40googlegroups.com?utm_medium=email_source=footer>.

--
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 
<mailto:django-users+unsubscr...@googlegroups.com>.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAFKhtoRactd%2Bhg-3_m8d5MOKSYb0gp9J9m%2BjNM7naykJ8r3Kww%40mail.gmail.com <https://groups.google.com/d/msgid/django-users/CAFKhtoRactd%2Bhg-3_m8d5MOKSYb0gp9J9m%2BjNM7naykJ8r3Kww%40mail.gmail.com?utm_medium=email_source=footer>.


--
This message has been scanned for viruses and
dangerous content by *MailScanner* <http://www.mailscanner.info/>, and is
believed to be clean.


--
You receiv

Re: it is very hard to find both email and phone number as username to login

2023-02-26 Thread Paul Kudla (SCOM.CA Internet Services Inc.)



I use a plugin / python program

AUTHENTICATION_BACKENDS = (
# AxesStandaloneBackend should be the first backend in the 
AUTHENTICATION_BACKENDS list.

'axes.backends.AxesModelBackend',

'django.contrib.auth.email-auth.EmailBackend',
'django.contrib.auth.backends.ModelBackend',
 )

email-auth.py

place in project root or

/usr/local/lib/python2.7/site-packages/Django-1.11.29-py2.7.egg/django/contrib/auth

use phone number for the user account id and email address will kick in 
automatically


can use either for login with valid password



___
# cat email-auth.py
from django.contrib.auth.models import User
import re

# vem = Verify E-Mail.  This regular expression is from 
http://www.regular-expressions.info/email.html

# and is designed to detect anything that meets the RFC-2822 standard.
vem = 
re.compile(r"""(?:[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*|"(?:[\x01-\x08\x0b\x0c\x0e-\x1f\x21\x23-\x5b\x5d-\x7f]|\\[\x01-\x09\x0b\x0c\x0e-\x7f])*")@(?:(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?|\[(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?|[a-z0-9-]*[a-z0-9]:(?:[\x01-\x08\x0b\x0c\x0e-\x1f\x21-\x5a\x53-\x7f]|\\[\x01-\x09\x0b\x0c\x0e-\x7f])+)\])""", 
re.I)



class BasicBackend:
def get_user(self, user_id):
try:
return User.objects.get(pk=user_id)
except User.DoesNotExist:
return None

class EmailBackend(BasicBackend):
def authenticate(self, username=None, password=None):
#If username is an email address, then try to pull it up
if vem.search(username):
try:
user = User.objects.get(email=username)
except User.DoesNotExist:
return None
else:
#We have a non-email address username we should 
try username

try:
user = User.objects.get(username=username)
except User.DoesNotExist:
return None
if user.check_password(password):
return user
________




Happy Sunday !!!
Thanks - paul

Paul Kudla


Scom.ca Internet Services <http://www.scom.ca>
004-1009 Byron Street South
Whitby, Ontario - Canada
L1N 4S3

Toronto 416.642.7266
Main 1.866.411.7266
Fax 1.888.892.7266
Email p...@scom.ca

On 2023-02-26 8:35 a.m., Manobhav Joshi wrote:
is there any way to use both email and phone number as username to login 
safely which we can use authenticate() function.


--
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 
<mailto:django-users+unsubscr...@googlegroups.com>.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/fd5721c4-0a55-48c3-8a1c-5ef75e470e1cn%40googlegroups.com <https://groups.google.com/d/msgid/django-users/fd5721c4-0a55-48c3-8a1c-5ef75e470e1cn%40googlegroups.com?utm_medium=email_source=footer>.


--
This message has been scanned for viruses and
dangerous content by *MailScanner* <http://www.mailscanner.info/>, and is
believed to be clean.


--
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/a875a175-d6d2-1ab2-c9aa-3460ee1e97c8%40scom.ca.


Re: Need help Scraping a couple of websites

2022-12-16 Thread Paul Kudla (SCOM.CA Internet Services Inc.)



please contact me directly

i am familiar with all sorts of databases and have had to migrate data 
across multiple platforms.


Toronto 416.642.7266
Main 1.866.411.7266
Fax 1.888.892.7266
Email p...@scom.ca


Happy Friday !!!
Thanks - paul

Paul Kudla


Scom.ca Internet Services <http://www.scom.ca>
004-1009 Byron Street South
Whitby, Ontario - Canada
L1N 4S3

Toronto 416.642.7266
Main 1.866.411.7266
Fax 1.888.892.7266
Email p...@scom.ca

On 2022-12-16 12:11 p.m., John McClain wrote:

Hello,

I need help scraping a couple of commercial websites to collect product 
data for use in e-commerce store.


Willing to pay modest fee for the help.

Get in touch if interested...

--
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 
<mailto:django-users+unsubscr...@googlegroups.com>.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/acadd169-b7a3-42c9-b6ce-6ebe10ccf344n%40googlegroups.com <https://groups.google.com/d/msgid/django-users/acadd169-b7a3-42c9-b6ce-6ebe10ccf344n%40googlegroups.com?utm_medium=email_source=footer>.


--
This message has been scanned for viruses and
dangerous content by *MailScanner* <http://www.mailscanner.info/>, and is
believed to be clean.


--
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/a6a61786-87a3-cd36-80df-27a36bcc66cb%40scom.ca.


Re: how can i create databases, routers and install apps in runtime?

2022-10-31 Thread Paul Kudla



just add them using a text editor (vi etc)

when you need to access them an import settings (already shoud be done) 
will present them


python 101 stuff more then django

fyi



Happy Monday !!!
Thanks - paul

Paul Kudla


Scom.ca Internet Services <http://www.scom.ca>
004-1009 Byron Street South
Whitby, Ontario - Canada
L1N 4S3

Toronto 416.642.7266
Main 1.866.411.7266
Fax 1.888.892.7266
Email p...@scom.ca

On 10/31/2022 8:28 AM, emilton mendoza wrote:
Could someone tell me how I can add new values ​​to the variables of 
settings.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 
<mailto:django-users+unsubscr...@googlegroups.com>.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/ddf803a2-d90b-45e4-a3c9-920ff73a43abn%40googlegroups.com <https://groups.google.com/d/msgid/django-users/ddf803a2-d90b-45e4-a3c9-920ff73a43abn%40googlegroups.com?utm_medium=email_source=footer>.


--
This message has been scanned for viruses and
dangerous content by *MailScanner* <http://www.mailscanner.info/>, and is
believed to be clean.


--
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/d85631c6-8a6f-cd32-8dd0-2b391278e80a%40scom.ca.


Re: secret api keys

2022-10-27 Thread Rajesh Kr. Paul
If you set debug=true, that's show only errors in url, views, and
templates. Have no chance to show your secret key, which you placed in
settings.py file.

On Thu, 27 Oct, 2022, 5:04 am Muhammad Juwaini Abdul Rahman, <
juwa...@gmail.com> wrote:

> People can't see it straight away.
>
> However, let's say if you forgot to set debut = False, they can see it.
> Not straight away, but very trivial.
>
> It is advisable to put your secret keys in external file (.env for
> example) and use library like django-environ to get the value.
>
> On Wed, 26 Oct 2022 at 23:09, john fabiani  wrote:
>
>> Hi,
>>
>> Maybe a dumb question but if I add secret keys in my settings.py file
>> (or should it be placed) will they be protected from the front end side
>> (the part that is displayed to the user of the website).
>>
>> For example I have a secret key to access Authorize Net.  Will it be
>> protected from someone opening the website and using chrome to see the
>> source?
>>
>> Johnf
>>
>> --
>> 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/eeb82d0a-f18d-c253-a613-24c685307f41%40jfcomputer.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/CAFKhtoSOzw7DcJmnXOrszXrv5OZ9Dt%2BJ%3D%2BAQaJhGczGL3-e%3DQQ%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/CAGw%2B2wJgyYB-9zD5ccs%3Daoq0R--94AtdrZvweCYm1oeomPMWsA%40mail.gmail.com.


Re: Django call_command from Admin

2022-10-24 Thread Paul Kudla



example for admin.py

def save_model(self, request, obj, form, change): #This will save create
#Check to see if this will be an invoice copy
copy = False
current_invoice = obj.invoice_number
		if obj.new_invoice :	#clear the flag and save the current object then 
set new & date

obj.new_invoice = False
obj.save()
copy = True




Happy Monday !!!
Thanks - paul

Paul Kudla


Scom.ca Internet Services <http://www.scom.ca>
004-1009 Byron Street South
Whitby, Ontario - Canada
L1N 4S3

Toronto 416.642.7266
Main 1.866.411.7266
Fax 1.888.892.7266
Email p...@scom.ca

On 10/20/2022 12:05 PM, Aziz Mek wrote:

Hi All,

I was wondering  if you have come across the following:

I have a field in the model that's empty, when the user fills it up and 
clicks Save, it
should trigger/call a management Command (This command is already build 
that sends emails ), Django docs say i can use call_command but not sure 
how to implement it with the save


I am just after the trigger really when the save takes place

Many thanks in advance

Kind regards
Aziz


--
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 
<mailto:django-users+unsubscr...@googlegroups.com>.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/a0ca69f0-6065-4b86-a977-cfb6dcab8fd7n%40googlegroups.com <https://groups.google.com/d/msgid/django-users/a0ca69f0-6065-4b86-a977-cfb6dcab8fd7n%40googlegroups.com?utm_medium=email_source=footer>.


--
This message has been scanned for viruses and
dangerous content by *MailScanner* <http://www.mailscanner.info/>, and is
believed to be clean.


--
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/c1f3567f-e13c-0a12-4f5e-ce0af7eaf115%40scom.ca.


Re: Django call_command from Admin

2022-10-24 Thread Paul Kudla



you need to basically add a hook (save class) to your save model and 
process stuff along the way.


you will need to modify this example but it's how i update info when 
saving an scom email user for dovecot.


you can also override the admin class as well with something simaliar

Note :
super(EmailUsers, self).save(*args, **kwargs)  #Save the email changes

is extemely important as stuff will process but any field updates will 
not save without the above line..


example :


	def save(self, *args, **kwargs): #This will create an email account if 
nessesary.
		emailaddress = str(self.username) #Set the email address to see if we 
need to create the mailbox?
		emailpassword = str(self.password) #Set the password (used for check 
alias)


#prefill username/domain is blank
if self.domain == None or str(self.domain) == '' :
self.domain = self.username.split('@')[1]

if self.source == None or str(self.source) == '' :
self.source = self.username

if self.destination == None or str(self.destination) == '' :
self.destination = self.username




domain = str(self.domain)
send_settings = str(self.send_settings)
if self.send_settings == None :
send_settings = ''
self.send_settings = ''
dontupdate = self.dontupdate
self.dontupdate = False

#set dovecot directory & split user / domain
if self.username.split('@')[1] == 'preload.scom.ca' :
			self.home = '/data/dovecot/users/%s/%s' %( 
self.domain,self.destination.split('@')[0] )

else:
self.home = '/data/dovecot/users/%s/%s' %( 
self.domain,self.destination )

self.user = self.username.split('@')[0]

#Set alias Flag
if self.password == 'alias' or (self.source != 
self.destination) :
self.alias_flag = True
#self.sieve_forwards = ''
#self.vacation_active = False
else :
self.alias_flag = False

self.username_search = self.username
self.username_search = self.username_search.replace ('.','')
self.username_search = self.username_search.replace ('@','')


super(EmailUsers, self).save(*args, **kwargs)  #Save the email 
changes

i email with something like :

#Try to get info for this account
if dontupdate == False :

			imap_test = Dovecot_Command ('INFO',self.username) #do i have this 
account ?


if 'BAD' in imap_test.answer :
try : #Try to Create the account, note that the db must be updated 
properly before it will work

imap_create = Dovecot_Command 
('CM',self.username)
if 'OK' in imap_create.answer :
send_subject = 'Email Account 
Created : %s' %(str(self.username) )

except :
send_subject = 'Error Account : %s' 
%(str(self.username) )
pass

else :
send_subject = 'Email Account Updated : %s' 
%(self.username)

#Send update email

send_from = 'moni...@scom.ca'
send_files = []
send_to = ['moni...@scom.ca']   
send_text = '\n\n'+ send_subject + '\n'
			sendmail(send_from,send_to,send_subject,send_text,send_files) #Send 
the warning email





Happy Monday !!!
Thanks - paul

Paul Kudla


Scom.ca Internet Services <http://www.scom.ca>
004-1009 Byron Street South
Whitby, Ontario - Canada
L1N 4S3

Toronto 416.642.7266
Main 1.866.411.7266
Fax 1.888.892.7266
Email p...@scom.ca

On 10/21/2022 2:30 PM, Mohammad Ehsan Ansari wrote:

Please refer the signal concept in django you will get how to implement it

On Thu, 20 Oct, 2022, 9:36 pm Aziz Mek, <mailto:aziz...@gmail.com>> wrote:


Hi All,

I was wondering  if you have come across the following:

I have a field in the model that's empty, when the user fills it up
and clicks Save, it
should trigger/call a management Command (This command is already
build that sends emails ), Django docs say i can use call_command
but not sure how to implement it with the save


Re: Why I love Django

2022-09-11 Thread Paul Onteri
Thanks!

On Sunday, 11 September 2022 at 05:06:58 UTC+3 robbi...@gmail.com wrote:

> Hello Paul
>
> On 10/9/2022 9:15 pm, Paul Onteri wrote:
> > Choosing a web framework is hard. Especially now when there are a lot of 
> > frameworks on the market, each designed to address different project 
> > needs. Here is why I think that when building a large database-driven 
> > application, I would honestly pay to use Django.
> > 
> > https://paulonteri.com/thoughts/love-django 
> > <https://paulonteri.com/thoughts/love-django>
> > 
>
> Nice blog post. I enjoy reading the content. Keep writing!
> -- 
> Regards
> Robbi Nespu
>
> PGP: D311 B5FF EEE6 0BE8 9C91 FA9E 0C81 FA30 3B3A 80BA
>

-- 
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/7d5dfc8c-e4a2-4408-9287-6620c182a6b3n%40googlegroups.com.


Re: django deploy on IIS

2022-09-10 Thread Paul Kudla (SCOM.CA Internet Services Inc.)



Ok please do not take this the wrong way .

this comes from 20+ years of experience of all the different platforms.

windows is good for microsoft office etc, they have kinda set the 
standard in day to day useage to run a business.


however 

production servers today are almost entirley on the unix side of the 
platforms.


although you could  try getting a windows IIS running (never tried and i 
do apologise for answering this thread saying that - i appreciate your 
frustration)


to get django to run on IIS (or consider windows apache would probably 
be better but at the end of the day ???)



i did try server 2019 + python3 + django + apache etc etc and gave up 
ended up putting the project on their freebsd router.



a lot of work would be spent when unix flavors are more suited to stuff 
like this.


at the end of the day windows is just not stable for multiple reasons.


too many lib issues to mention a few.

if you are running any kind of production server you really should look 
at a linux flavor (i use freebsd as it has several enhancements to the 
network layer)


Again not an answer but maybe it is !



Happy Saturday !!!
Thanks - paul

Paul Kudla


Scom.ca Internet Services <http://www.scom.ca>
004-1009 Byron Street South
Whitby, Ontario - Canada
L1N 4S3

Toronto 416.642.7266
Main 1.866.411.7266
Fax 1.888.892.7266
Email p...@scom.ca

On 9/10/2022 1:01 PM, jayson lauwerends wrote:

Hello,
Does anyone here know how to get a Django project to work on IIS.
I have been trying for the last three weeks following different tutorials.
Everyone on stack overflow is giving different answers.
And i am losing my m9nd.

--
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 
<mailto:django-users+unsubscr...@googlegroups.com>.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/c91b9d18-af31-441f-a5a6-7b9e2a23f2edn%40googlegroups.com <https://groups.google.com/d/msgid/django-users/c91b9d18-af31-441f-a5a6-7b9e2a23f2edn%40googlegroups.com?utm_medium=email_source=footer>.


--
This message has been scanned for viruses and
dangerous content by *MailScanner* <http://www.mailscanner.info/>, and is
believed to be clean.


--
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/8a14bd2c-7fdb-b1b7-436e-c99b529c1985%40scom.ca.


Why I love Django

2022-09-10 Thread Paul Onteri
Choosing a web framework is hard. Especially now when there are a lot of 
frameworks on the market, each designed to address different project needs. 
Here is why I think that when building a large database-driven application, 
I would honestly pay to use Django.

https://paulonteri.com/thoughts/love-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/0ae12e86-c427-4f35-aa9b-1150e8bd06fdn%40googlegroups.com.


Re: What do you do with large project and forms?

2022-08-30 Thread Paul serubombwe
You need to work with model forms, but not forms, in your templates
implement crispy forms  to avoid over coding

On Wed, Aug 31, 2022, 03:03 Mike Dewhirst  wrote:

> 1. Create a forms directory
> 2. Create ../forms/__init__.py
> 3. Move your forms.py into the forms directory
> 4. In ./__init__.py write from .forms import (
>   FormThis,
>   FormThat,
>   EtcForm,
> )
>
> This gives you unchanged forms calling from wherever ... from
> appname.forms import etc
>
> 5. When all that is working split your 3k forms.py into appropriately
> named smaller files each containing the form class or classes you prefer
> and adjust the ./__init__.py imports accordingly
>
> You might encounter occasional circular imports but you should get the
> hang of it soon enough.
>
> Cheers
>
> Mike
>
>
>
> --
> (Unsigned mail from my phone)
>
>
>
>  Original message 
> From: Julio Cojom 
> Date: 31/8/22 03:42 (GMT+10:00)
> To: django-users@googlegroups.com
> Subject: What do you do with large project and forms?
>
> I have a large project and forms.py per app is bigger than I thought with
> 3k+ lines in each file, I'm looking for options to make a good scalation
> structure, does anyone have experience with this? What do you do to
> organize your forms in your projects?
>
> --
> 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/CAHRQUHnd2zdPeaOmw2VzWhP2y1xN%3Dv2Z%2BQ%2B%2BsSw1B10AuxEnjA%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/630ea50d.620a0220.480de.4507SMTPIN_ADDED_MISSING%40gmr-mx.google.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/CAJkmis2wo7HzxxPPxPO3A9JgOcsrktpb0OGPRX4O0DwFA%2B3Q5w%40mail.gmail.com.


Re: Guys i have issue while loading sub module in django app

2022-08-28 Thread Paul serubombwe
Elaborate more bro, what do you mean by sub model

On Sat, Aug 27, 2022, 23:56 देव Hingu  wrote:

> Please check here for my problem
>
> https://stackoverflow.com/questions/73499743/cant-find-load-sub-module-inside-django-appmodule-dynamically
>
> --
> 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/287b9213-d6d6-4e03-be1f-3b7027ec3bben%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/CAJkmis2j0UjNvFThqYactPY%2BCO-qUukT3OLP%2B%2BQXdb%3DO5UTYGg%40mail.gmail.com.


Re: Why do we need Django rest framework when our conventional django do what we want?

2022-08-26 Thread Paul serubombwe
Its a requirement if your application is using 1. a fronted framework,
2. If your going to integrate APIs for instance payment APIs etc. And its
also good in authentication.
On Aug 26, 2022 6:19 AM, "Ryan Nowakowski"  wrote:

> On Sun, Jul 31, 2022 at 12:55:46AM -0700, Joseph Bashorun wrote:
> > I am stuck in a loop of confusion. I am trying to build an ecommerce
> > website and make it production ready. Do i need to build an API for it?
>
> No   https://twitter.com/htmx_org/status/1561808410856898561
>
> --
> 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/20220826031841.GG7295%40fattuba.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/CAJkmis1qXdtxEJz63O_a5cSwy00UZawxo4E9RukJrd8D8aeBJw%40mail.gmail.com.


Re: I need help with saving data to django database.

2022-08-17 Thread Paul Kudla (SCOM.CA Internet Services Inc.)
float(item.item_unit)
invoice.sub_total = float(invoice.sub_total) + 
float(item.item_extention)

item.save()

#Now the taxes
if invoice.gst_tax_exempt == False :
			invoice.gst_tax_amount = float(invoice.sub_total) * 
float(invoice.gst_tax_value) / 100

else :
invoice.gst_tax_amount = float(0)

if invoice.hst_tax_exempt == False :
			invoice.hst_tax_amount = float(invoice.sub_total) * 
float(invoice.hst_tax_value) / 100

else :
invoice.hst_tax_amount = float(0)   

if invoice.pst_tax_exempt == False :
			invoice.pst_tax_amount = float(invoice.sub_total) * 
float(invoice.pst_tax_value) / 100

else :
invoice.pst_tax_amount = float(0)   

		invoice.invoice_total = float(invoice.sub_total) + 
float(invoice.gst_tax_amount) + float(invoice.hst_tax_amount) + 
float(invoice.pst_tax_amount)


if invoice.ar_owing == '99' :
invoice.ar_owing = invoice.invoice_total

#Now the a/r
total_ar = float(invoice.invoice_total)
try :
			record = Invoice_Payment.objects.all().filter( payment_item = '%s' 
%invoice.invoice_number )

for nn in range (0,len(record)) : #start the update
total_ar = total_ar - 
float(record[nn].cashbook_amount)
except : pass

invoice.ar_owing = total_ar #set the new ar value


invoice.save()

#Now generate the pdf's
		if invoice.printed == True or invoice.faxed == True or invoice.emailed 
== True :

makeinvoicepdf(invoice.invoice_number)



site.register(Invoice, InvoiceAdmin)


this is an example of my contacts save overrides in models.py:

	def save(self, *args, **kwargs):  #This will save / create the contact 
entry

super(Contacts, self).save(*args, **kwargs) #Save the contact 
entry
self.accountid_text = '0'
		self.accountid_text = 
self.accountid_text[0:5-len(str(self.accountid))] + str(self.accountid)


#See if i am going to email this contact ?
if not self.send_to == '' : #Send an email with contact info
			send_subject = 'Contact Info for : %s   -  %s' 
%(self.customer_name,self.send_to_subject)

send_from = 'i...@scom.ca'
send_files = []
send_to = self.send_to.split(',')
#Build the email text entry
send_text = '\n\n%s\n%s\n%s\n%s\n%s\n%s\n%s\n\n' \
	 
%(self.customer_name,self.attention_to,self.address_1,self.address_2,self.city,self.province,self.postal_code)


#for nn in range (0,len(self.phone_number) ):
#   phone_data = self.phone_number[nn]

self.phonenumber = ''
			for self.item in 
Contacts.objects.get(pk=self.accountid).phone_number.all():
if str(self.item.phone_number) == '' or str(self.item.phone_number) 
== 'None' or str(self.item.phone_type) == 'Fax' :

pass
else :
if self.phonenumber <> '' :
self.phonenumber = 
self.phonenumber + ' / '

	self.phonenumber = self.phonenumber + '(' + 
str(self.item.phone_type) + ') ' + str(self.item.phone_number)


send_text = send_text + self.phonenumber + '\n\n'

			sendmail(send_from,send_to,send_subject,send_text,send_files) #Send 
the warning email

self.send_to = '' #Clear the entry
self.send_to_subject = ''



#Save the contact entry (in case of new record)
		super(Contacts, self).save(*args, **kwargs) #Save the contact entry 
(in case of new record)





Happy Wednesday !!!
Thanks - paul

Paul Kudla


Scom.ca Internet Services <http://www.scom.ca>
004-1009 Byron Street South
Whitby, Ontario - Canada
L1N 4S3

Toronto 416.642.7266
Main 1.866.411.7266
Fax 1.888.892.7266
Email p...@scom.ca

On 8/16/2022 1:21 PM, Viando Donwasta wrote:

Hi,
May I get help with this project? I am new to Django. Below is my view 
and model for your review.



class Invoice(models.Model):

     Invoic

Re: Static Code analysis and Security Scanning tools for Django Web Applications

2022-07-13 Thread Paul Tiplady
I also use safety  to scan for package 
vulnerabilities in the pipeline. This is similar to a repo-scanning app 
like Dependabot or Snyk.

Prospector is decent, although I found it preferable to use pre-commit 
 to wire up individual tools like bandit, black, 
./manage.py check, safety, flake8 -- that way I can run them as individual 
build jobs that run in parallel in the build pipeline, rather than one 
command invocation.

On Tuesday, July 5, 2022 at 10:17:14 PM UTC-7 ram.mu...@gmail.com wrote:

> Hi,
>
> We have tried Prospector tool: https://prospector.landscape.io/en/master/
>
> and got the following result
>
>
> Check Information
>> =
>>  Started: 2022-07-05 20:29:59.548372
>> Finished: 2022-07-05 20:38:58.411776
>>   Time Taken: 538.86 seconds
>>Formatter: grouped
>> Profiles: default, no_doc_warnings, no_test_warnings, 
>> strictness_medium, strictness_high, strictness_veryhigh, no_member_warnings
>>   Strictness: None
>>   Libraries Used: django, celery
>>Tools Run: dodgy, mccabe, profile-validator, pycodestyle, 
>> pyflakes, pylint
>>   Messages Found: 17186
>
>
> but wondering if you guys use any other better tools than this. Our goal 
> is find out gaps and error from the following items:
>
> 1. Security scanning
> 2. Static code analysis
> 3. Vulnerabilities scanning
>
> Best regards,
> ~Ram
>
>
>
>
>

-- 
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/1edee7b5-f410-4759-9316-a6705360ea78n%40googlegroups.com.


Using activate() to set the timezone in Model Admin

2022-07-13 Thread Paul Tiplady
I'd like to have my Admin site use a different default timezone than the 
rest of my django app.

I prefer the backend and API to operate in UTC, because this is a general 
good practice for geographically distributed teams. However admin users 
(based in a specific timezone) find this confusing, and would like to see 
their datetimes in a local timezone (say, Pacific Time).

The docs state that a local time can be set using 
activate(): 
https://docs.djangoproject.com/en/4.0/ref/utils/#django.utils.timezone.activate

Specifically: 
https://docs.djangoproject.com/en/4.0/topics/i18n/timezones/#default-current-time-zone
 
says "You should set the current time zone to the end user’s actual time 
zone with activate() 
.
 
Otherwise, the default time zone is used.".

Where should this be done to set the timezone only in the admin?

Simon Wilson has a suggestion to set this globally using 
Middleware: https://til.simonwillison.net/django/show-timezone-in-django-admin

I'm wondering if there's a better way that won't affect the TZ of non-admin 
requests. It seems that this should be configurable somewhere on the 
AdminSite.

Has anyone made this work specifically for the Django Admin?

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/7d09876e-5cdf-4010-abb1-bdbf5a71f41fn%40googlegroups.com.


Re: Fetch email from google

2022-07-08 Thread Paul Kudla (SCOM.CA Internet Services Inc.)
ons of 
legalized theft, extortion, and wrongful appropriation through state, 
local, military and federal court systems, individuals with similar 
names to known criminals are not allowed to hold significant assets in 
their names or possess firearms or obtain employment in sensitive 
positions in the United States.

>
> * https://en.wikipedia.org/wiki/Thief_in_law
>
> On Sunday, June 26, 2022 2:52:05 PM AKDT, Steve Dondley wrote:
>> I have a small client whose insurance company insists they have MFA 
for their email to be covered under some kind of data protection policy. 
Currently I have the client set up on a Debian box for the email server 
coupled with roundcube for webmail. Most the users just use roundcube 
but some also use their mobile devices to check email. Maybe one person 
uses outlook. There’s about 5 to 10 users total.
>> I know roundcube offers a MFA plugin. But I don’t have the foggiest 
idea how of an iPhone, Android device, or Outlook could all be set up to 
work with MFA with a standard dovecot/postfix setup. Are there any 
practical solutions for easily implementing MFA that could work across 
multiple devices?

>>


Disclaimer: I work for Auth0 (now Okta)

On 7/3/22 9:40 AM, Paul Kudla (SCOM.CA Internet Services Inc.) wrote:
>
> It seems any kind of dual auth will need a security app running on 
YOUR server saving toikens, logins etc etc


Not necessarily. With Auth0, the IDP runs on Auth0's server.
You are responsible for storing ID tokens, access tokens, and refresh 
tokens in your app.
There are ways of doing this fairly securely, even with desktop apps or 
mobile

devices, where you don't have a secure backend.

>
> this is what lead to microsoft, gmail etc having their own api which 
will only work for them


If I understand this correctly, Google et al provide an MFA API for apps 
that want to handle
auth themselves, instead of going the OIDC/OAuth2/SAML route. They also 
provide standards

based protocols, like OIDC.

That's what I was hinting at above - adopting OIDC makes things easier 
than trying to bolt

on security (via some MFA API).

>
> this is also (mainly because of https authing the device) what makes 
it hard to proxy oauth2 etc


This is definitely a pain point. You can either open up a browser from 
the device, or on constrained
devices, use device flow (display a URL, user visits that URL on their 
laptop, device grabs confirmation
from the IDP that they did). Neither one is completely elegant, but 
opening a browser on a mobile

device is far less intrusive than you might think.

>
> 5.7. Authenticating using C.A.S.
> ...
>
> basically the reality is every server will have it's own token base 
etc thus preventing any kind of a standard.


I'm not familiar with C.A.S. I don't have any clients that I know of 
using it, so I can't comment on it.

But the JWT token spec is now common, and is a standard. Also the SAML spec.
I see more OIDC, but also a lot of SAML.

Happy IAM Sunday to you too!

j



It IS possible to use 2FA on Dovecot, but it would be better if Dovecot 
supported options by Plugins to control what supported 2FA options are 
supported in the CAPABILITIES string.  (Ongoing problem getting more 
power in the handles of 3rd party plugins for Dovecot, politics.. )


HOWEVER, there are many ways if you 'roll your own' dovecot, eg can 
apply patches to the build process.  We do this.


Having said that, yes.. especially in North America this push by 
insurance agents for 2FA, is driven by the RansomWare problems, and 
gives an insurance company a way out..


The only problem is, having looked at several of these insurance 
companies forms, it is almost as if a o365 sales person wrote the 
requirements.  And even IF you apply a 2FA, (eg a 2nd factor) you might 
find that the insurance documents will not accept anything other than 
what their legal department defined as 2FA..


The biggest problem, is not the use of 2FA, it is making 2FA transparent 
and simple enough for end users to adopt.  End users don't want to mess 
with a second factor they have to add, or a hardware dongle, or giving 
their cel# out..


And the industry has to come together, otherwise you will quickly find 
out insurance companies ONLY accept 2FA from one or two closed source 
companies..


Which is why once again, I wish that Dovecot would take a leadership 
role in this, and allow more 3rd party plugins to be available to 
address this business need.


(Oh, on the side, there ARE some ways you actually do 2FA transparently, 
but of course the email client has to understand it.  But while you can 
do 'tricks' even in IMAP for 2FA, we need to think that the same method 
should work for ALL communication channels which utilize the same 
credentials, eg IMAP/SMTP/POP, even other things like caldav/carddav etc)


-- Michael --

On 2022-06-27 07:53, justina colmena ~biz wrote:
> I don't see why not.
>
> Dovecot and P

Re: server can't connect in browser

2022-06-23 Thread Paul Kudla (SCOM.CA Internet Services Inc.)



ok this is networking 101 stuff

if the server is running on 127.0.0.1 8000 (or whatever port)

and you are trying to access from another system you need to use the ip 
address of the server (not 127.0.0.1) and it needs to be accesable on 
your network to be able to find it.


best to try telneting to the server as a test to verify ip & ports are 
correct.


example :

telnet 192.168.0.2  8000  for example if you get 
a response then you are good to go.


ie

"telnet 192.168.0.2 8000"





Happy Thursday !!!
Thanks - paul

Paul Kudla


Scom.ca Internet Services <http://www.scom.ca>
004-1009 Byron Street South
Whitby, Ontario - Canada
L1N 4S3

Toronto 416.642.7266
Main 1.866.411.7266
Fax 1.888.892.7266
Email p...@scom.ca

On 6/22/2022 1:46 PM, Django-Admin wrote:
Try opening the link in a browser in the same EC2 instance, if you are 
not doing so.


On Wednesday, June 22, 2022 at 6:37:18 PM UTC+5:30 kamald...@gmail.com 
wrote:


Hi all,
I am quite new in django. Just started my first project in it.
I started an ec2 instance, setup virtual environment and run server
through
python manage.py runserver command.
Server is up with no errors. But when I copy the link and open in
browser it says site can't be reached. Screenshots of it are
attached for reference.

--
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 
<mailto:django-users+unsubscr...@googlegroups.com>.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/dfe8f847-65bc-4602-b3b9-9e7a81998459n%40googlegroups.com 
<https://groups.google.com/d/msgid/django-users/dfe8f847-65bc-4602-b3b9-9e7a81998459n%40googlegroups.com?utm_medium=email_source=footer>.


--
This message has been scanned for viruses and
dangerous content by *MailScanner* <http://www.mailscanner.info/>, and is
believed to be clean.


--
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/eef876cb-0c0c-5123-63f2-3fc6b727eac5%40scom.ca.


Re: ?? question ,its urgent

2022-06-20 Thread Paul Kudla (SCOM.CA Internet Services Inc.)



Just an fyi your email showed up as suspect ??

spf=softfail (google.com: domain of transitioning 
abhinan...@snakescript.com does not designate 2607:f8b0:4864:20::62b as 
permitted sender)


might want to get that fixed




Happy Monday !!!
Thanks - paul

Paul Kudla


Scom.ca Internet Services <http://www.scom.ca>
004-1009 Byron Street South
Whitby, Ontario - Canada
L1N 4S3

Toronto 416.642.7266
Main 1.866.411.7266
Fax 1.888.892.7266
Email p...@scom.ca

On 6/20/2022 2:46 AM, Abhinandan K wrote:
how to store the data in django databse table if user append fields 
according to their need

for example i have 1 one field 1) name 2) age 3) salary and the sign('+)
if user click on + sign row append one plus in form..my question is that 
i want to store the data in all appended textboxes in single field in 
database,,


--
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 
<mailto:django-users+unsubscr...@googlegroups.com>.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAA6_Mp6UPLakoi-JhcgB4U89-iKfDwAaxDWwW547tFKyk_imrg%40mail.gmail.com 
<https://groups.google.com/d/msgid/django-users/CAA6_Mp6UPLakoi-JhcgB4U89-iKfDwAaxDWwW547tFKyk_imrg%40mail.gmail.com?utm_medium=email_source=footer>.


--
This message has been scanned for viruses and
dangerous content by *MailScanner* <http://www.mailscanner.info/>, and is
believed to be clean.


--
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/f5251350-9b5b-a938-408f-124b590b5c37%40scom.ca.


Re: Django email | Gmail | Outlook

2022-06-02 Thread Paul Kudla (SCOM.CA Internet Services Inc.)



thanks for the hint on gmailapi

i figure they had something outlook has an azure server plugin (same idea)

just an fyi i was taking a more generalized approach to the issue

as an isp i have customers spanning several different providers needing 
a more generalized solution.


gmail, office, rogers, aol, yahoo etc etc etc

i generally use fetchmail to handle this but there is no oauth2 
avaliable yet and you still need a device key - aka manual setup


I am putting together a python program to handle this the main issue is 
getting prompted backwards in html on a new device / connection and 
busilding some sort of connect library per provider.


Afterwhich i save the device key in a local database for future use?





Happy Thursday !!!
Thanks - paul

Paul Kudla


Scom.ca Internet Services <http://www.scom.ca>
004-1009 Byron Street South
Whitby, Ontario - Canada
L1N 4S3

Toronto 416.642.7266
Main 1.866.411.7266
Fax 1.888.892.7266
Email p...@scom.ca

On 5/31/2022 4:31 PM, Dev femibadmus wrote:

i have solved my issue using the gmailapi anyone having same issue??


On Mon, May 30, 2022 at 2:57 PM Dev femibadmus <mailto:devfemibad...@gmail.com>> wrote:


Wow  thanks  so much Paul

On Mon, May 30, 2022, 13:40 Paul Kudla (SCOM.CA <http://SCOM.CA>
Internet Services Inc.) mailto:p...@scom.ca>> wrote:


Unfortunately gmail / outlook although on different time tables
will
force oauth2 shortly without end users being able to avoid this.

Thus outlook protocol will not really be an option.

I have researched this with python and alike.

right now there does not seem to be any turn key soultions in
python or
fetchmail (i use fetchmail for my older customers)

there seems to be lib's around to handle to oauth2 protocols but
not
much doc's on how to use them?


simply put from my research to date is oauth2 does the following

1. you try to connect to the mail server

2. it stops (unless you already have a device id key) and
redirects to a
website link for a key

3. once on the website you need to say yes to some kind of auth
(trying
to accomodate with http libs)

4. the website returns the key (which you probably should save)

5. from there (thus far research to date) normal python libs
will handle
emails thereafter as before.

other option is like with google where you need to signup for a
developer account (or something) that will generate a key for your
account & device at which point other emails to that, only good
for 15
devices ??

after that you have to pay?

just a heads up, other non-main stream providers (like myself) have
other devices in place for security and will not force customers to
migrate, maybe look for a local provider?

I will eventually handle oauth2 etc but only when forced to
(government
contracts etc)

My suggestion (if you are in unix) is to start up a postfix /
dovecot
email server instance where you are in control of the protocol's
used?
this way your in complete control of your emails in both
directions. Its
a bit of work but leaving things to the main stream providers isn't







Happy Monday !!!
Thanks - paul

Paul Kudla


Scom.ca Internet Services <http://www.scom.ca <http://www.scom.ca>>
004-1009 Byron Street South
Whitby, Ontario - Canada
L1N 4S3

Toronto 416.642.7266
Main 1.866.411.7266
Fax 1.888.892.7266
Email p...@scom.ca <mailto:p...@scom.ca>

On 5/30/2022 7:22 AM, Dev femibadmus wrote:
 > *Google* no longer support less seureappswhat next?
 > is there anyway we can use gmail for Django email?
 >
 >
 > if no way please send the best lesson for *Outlook*
configuration :)
 >
 > --
 > 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
<mailto:django-users%2bunsubscr...@googlegroups.com>
 > <mailto:django-users+unsubscr...@googlegroups.com
<mailto:django-users%2bunsubscr...@googlegroups.com>>.
 > To view this discussion on the web visit
 >

https://groups.google.com/d/msgid/django-users/5318be25-e226-489d-8586-155d9161dad5n%40googlegroups.com

<https://groups.google.com/d/msgid/django-users/5318be25-e226-489d-8586-155d9161dad5n%40googlegroups.com>

 &

Re: POS Printer

2022-05-31 Thread Paul Kudla (SCOM.CA Internet Services Inc.)



ok a few zillion requirements

You need something that will generate a pdf file and then send it to a 
printer / email etc


Basically Pillow libs needs to be installed to generate a pdf file

from there is is system dependant

if running linux / freebsd then i would write the pdf file into the /tmp 
folder (make sure you set the rights of /tmp to 777)


next to be able to print you will need ghostscript / cups

cups needs the printer to be on your network (NOT USB Preferably)

USB Can be made to work but requires a whole wack of printer setup on 
the stations.


also Report Lab (Pillow libs)

#PDF (Report Lab Stuff)
from reportlab.pdfgen import canvas
from reportlab.lib.units import inch
from reportlab.lib.pagesizes import letter, A4
from reportlab.lib import colors
from reportlab.graphics.shapes import *
from reportlab.platypus import SimpleDocTemplate, Image

from reportlab.lib.colors import PCMYKColor, PCMYKColorSep, Color, 
black, blue, red, orange



please understand that this is very rough approach

if you need more info a can send my django code if nessesary but is 
tailered to my system


fyi





Happy Tuesday !!!
Thanks - paul

Paul Kudla


Scom.ca Internet Services <http://www.scom.ca>
004-1009 Byron Street South
Whitby, Ontario - Canada
L1N 4S3

Toronto 416.642.7266
Main 1.866.411.7266
Fax 1.888.892.7266
Email p...@scom.ca

On 5/31/2022 10:00 AM, Asif Foysal wrote:

How to use POS printer in 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 
<mailto:django-users+unsubscr...@googlegroups.com>.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/23dc7e2f-3650-4ddb-8212-7a509f797fe1n%40googlegroups.com 
<https://groups.google.com/d/msgid/django-users/23dc7e2f-3650-4ddb-8212-7a509f797fe1n%40googlegroups.com?utm_medium=email_source=footer>.


--
This message has been scanned for viruses and
dangerous content by *MailScanner* <http://www.mailscanner.info/>, and is
believed to be clean.


--
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/bb26b262-97c7-5d24-e34c-e67b3ddd3bc2%40scom.ca.


Re: Django email | Gmail | Outlook

2022-05-30 Thread Paul Kudla (SCOM.CA Internet Services Inc.)



Unfortunately gmail / outlook although on different time tables will 
force oauth2 shortly without end users being able to avoid this.


Thus outlook protocol will not really be an option.

I have researched this with python and alike.

right now there does not seem to be any turn key soultions in python or 
fetchmail (i use fetchmail for my older customers)


there seems to be lib's around to handle to oauth2 protocols but not 
much doc's on how to use them?



simply put from my research to date is oauth2 does the following

1. you try to connect to the mail server

2. it stops (unless you already have a device id key) and redirects to a 
website link for a key


3. once on the website you need to say yes to some kind of auth (trying 
to accomodate with http libs)


4. the website returns the key (which you probably should save)

5. from there (thus far research to date) normal python libs will handle 
emails thereafter as before.


other option is like with google where you need to signup for a 
developer account (or something) that will generate a key for your 
account & device at which point other emails to that, only good for 15 
devices ??


after that you have to pay?

just a heads up, other non-main stream providers (like myself) have 
other devices in place for security and will not force customers to 
migrate, maybe look for a local provider?


I will eventually handle oauth2 etc but only when forced to (government 
contracts etc)


My suggestion (if you are in unix) is to start up a postfix / dovecot 
email server instance where you are in control of the protocol's used? 
this way your in complete control of your emails in both directions. Its 
a bit of work but leaving things to the main stream providers isn't








Happy Monday !!!
Thanks - paul

Paul Kudla


Scom.ca Internet Services <http://www.scom.ca>
004-1009 Byron Street South
Whitby, Ontario - Canada
L1N 4S3

Toronto 416.642.7266
Main 1.866.411.7266
Fax 1.888.892.7266
Email p...@scom.ca

On 5/30/2022 7:22 AM, Dev femibadmus wrote:

*Google* no longer support less seureappswhat next?
is there anyway we can use gmail for Django email?


if no way please send the best lesson for *Outlook* configuration :)

--
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 
<mailto:django-users+unsubscr...@googlegroups.com>.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/5318be25-e226-489d-8586-155d9161dad5n%40googlegroups.com 
<https://groups.google.com/d/msgid/django-users/5318be25-e226-489d-8586-155d9161dad5n%40googlegroups.com?utm_medium=email_source=footer>.


--
This message has been scanned for viruses and
dangerous content by *MailScanner* <http://www.mailscanner.info/>, and is
believed to be clean.


--
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/d3029493-4b38-903f-11f5-e5709cac9666%40scom.ca.


Re: What do they mean, exactly

2022-05-28 Thread Paul Kudla (SCOM.CA Internet Services Inc.)



this occurs when manage does not detect any changes to your project

or if the project folders have lost sync.

I have run into this before lots of times.

this is based on djando 1.11 but should work moving forward in principal.

In general try the following :

syncdb :

No longer exists 

when creating the database tables do the following :

remove ALL migrations directories in app's

manage makemigrations  DO FOR ALL APPS

manage migrate --fake-initial

manage migrate

manage createsuperuser (optional)

When creating new apps __init__.py must exist

manage migrate --fake-initial  to create the table(s)



the above will not destroy any db tables etc but if you added a field 
that never got updated to the database you will probably need to reverse 
the table changes (in your model), then sort the migrations out as per 
above and then re-add the table entries


This can happen when syntax errors, migrations errors occured on the 
last run and it did not make it far enough to add the fields?


hope this helps.

Happy Saturday !!!
Thanks - paul

Paul Kudla


Scom.ca Internet Services <http://www.scom.ca>
004-1009 Byron Street South
Whitby, Ontario - Canada
L1N 4S3

Toronto 416.642.7266
Main 1.866.411.7266
Fax 1.888.892.7266
Email p...@scom.ca

On 5/27/2022 4:12 PM, Sabir Ali wrote:

(Hpenv) E:\HealthPrediction>python manage.py makemigrations
_*No changes detected*_

(Hpenv) E:\HealthPrediction>


"No changes detected' what will i do Please help me. I am beginner in 
django. Please help me



On Friday, May 27, 2022 at 2:12:09 AM UTC+5:30 dcol...@gmail.com wrote:

I was reading the django docs and i have been confused by the
explanation as shown in the snippet.
Screenshot from 2022-04-29 01-36-59.png

in the first snippet of code does it mean that both conditions will
have to be met as in the case of "and" in logical operators?
Second snippet, do they imply that the blog objects will first be
filtered to have only those that contains "lennon" and then the
results will be filtered again to have only those in year 2008?

Please help

--
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 
<mailto:django-users+unsubscr...@googlegroups.com>.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/dd74a081-d8ce-464e-9ae4-5f87d9e849dan%40googlegroups.com 
<https://groups.google.com/d/msgid/django-users/dd74a081-d8ce-464e-9ae4-5f87d9e849dan%40googlegroups.com?utm_medium=email_source=footer>.


--
This message has been scanned for viruses and
dangerous content by *MailScanner* <http://www.mailscanner.info/>, and is
believed to be clean.


--
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/54e1bf6c-231b-e266-1401-f55cfe9c6a17%40scom.ca.


Re: OperationalError at /admin/login database or disk is full

2022-05-28 Thread Paul Kudla (SCOM.CA Internet Services Inc.)



ok i will assume you are running a flavor of unix aka linux, freebsd etc

/admin/login is a mount point but it depends on your hdd layout

for example depending on your hdd initalization


# df
Filesystem   SizeUsed 
Avail Capacity  Mounted on
zroot/ROOT/default   393G3.3G 
389G 1%/
devfs1.0K1.0K 
0B   100%/dev
zroot/var/tmp389G 96K 
389G 0%/var/tmp
zroot/tmp389G136K 
389G 0%/tmp
zroot/var/log389G1.4M 
389G 0%/var/log
zroot389G 96K 
389G 0%/zroot
zroot/var/mail   389G148K 
389G 0%/var/mail
zroot/usr/src391G1.7G 
389G 0%/usr/src
zroot/var/audit  389G 96K 
389G 0%/var/audit
zroot/usr/ports  399G9.4G 
389G 2%/usr/ports
zroot/usr/home   431G 42G 
389G10%/usr/home
zroot/var/crash  389G 96K 
389G 0%/var/crash


when you do s 'df' to list you hdd's it will give you the partition 
layouts and avaliable hdd space


if /admin/login is on it own partition then it probably has reduced size?

check that first

make sure you data base is running where there is plenty of space (ie /usr/)

otherwise post back your hdd layout

and do a

ps -axww

and return the process layouts

between the two you should be able to figure out where your database, 
dhango etc lives and go from there


keep in mind that default locations usually work but sometimes not 
pending how your system was formatted.






Happy Saturday !!!
Thanks - paul

Paul Kudla


Scom.ca Internet Services <http://www.scom.ca>
004-1009 Byron Street South
Whitby, Ontario - Canada
L1N 4S3

Toronto 416.642.7266
Main 1.866.411.7266
Fax 1.888.892.7266
Email p...@scom.ca

On 5/27/2022 5:37 PM, Andrew Rea wrote:

Hello!

This is my first post in this group so be gentle.

I'm creating a new Django project, and I've successfully created a 
superuser. But when I try to access the Admin page of my project with my 
superuser credentials, I receive this error:


OperationalError at /admin/login/
database or disk is full

Is this because my SQLite database is full from other projects? Or 
possibly because I have too many virtual envs from those same other 
projects? *Or* is it due to my personal computer's disk being too full?


Thank you in advance,

Andrew S. Rea

--
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 
<mailto:django-users+unsubscr...@googlegroups.com>.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/d96ae214-4c6f-43c7-ae94-7fba910e68a1n%40googlegroups.com 
<https://groups.google.com/d/msgid/django-users/d96ae214-4c6f-43c7-ae94-7fba910e68a1n%40googlegroups.com?utm_medium=email_source=footer>.


--
This message has been scanned for viruses and
dangerous content by *MailScanner* <http://www.mailscanner.info/>, and is
believed to be clean.


--
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/ed6369f9-23f7-d3ce-38e2-4c1437496fd2%40scom.ca.


tutorial 1 problems from djangoproject website - not working, do not exactly understand

2022-03-22 Thread Paul Kagan
root@videotron:~ # django-admin startproject mysite
root@videotron:~ # python manage.py runserver
python: can't open file 'manage.py': [Errno 2] No such file or directory
root@videotron:~ # ls
.Xauthority .elinks .nn .viminfogit
.cache  .emacs.d.npm.virtualenvsmbox
.cargo  .k5login.profile.vncmysite
.composer   .local  .rnd.weechat
.config .login  .shrc   about.txt
.cshrc  .mysql_history  .thelounge  ca.key
root@videotron:~ # cd mysite
root@videotron:~/mysite # ls
manage.py   mysite
root@videotron:~/mysite # python manage.py runserver
Traceback (most recent call last):
  File "manage.py", line 11, in main
from django.core.management import execute_from_command_line
ModuleNotFoundError: No module named 'django'

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "manage.py", line 22, in 
main()
  File "manage.py", line 17, in main
) from exc
ImportError: Couldn't import Django. Are you sure it's installed and 
available on your PYTHONPATH environment variable? Did you forget to 
activate a virtual environment?
root@videotron:~/mysite # ImportError: Couldn't import Django. Are you sure 
it's installed and available on your PYTHONPATH environment variable? Did 
you forget to activate a virtual environment?
-sh: ImportError:: not found
root@videotron:~/mysite # python
Python 3.7.10 (default, Apr 10 2021, 01:41:46)
[Clang 11.0.1 (g...@github.com:llvm/llvm-project.git 
llvmorg-11.0.1-0-g43ff75f2c on freebsd13
Type "help", "copyright", "credits" or "license" for more information.
>>> import django
Traceback (most recent call last):
  File "", line 1, in 
ModuleNotFoundError: No module named 'django'
>>> import django
Traceback (most recent call last):
  File "", line 1, in 
ModuleNotFoundError: No module named 'django'
>>> exit()
root@videotron:~/mysite #

-- 
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/6f165f01-f599-4764-98ac-7a15d5fb5df6n%40googlegroups.com.


Re: Where are you deploying Django App? How much does it cost for a hobby project

2021-10-04 Thread Paul Tiplady
You can deploy to Heroku, there's a free tier and it's very low maintenance.

https://devcenter.heroku.com/articles/deploying-python

I've had a free Django app running there that I set up almost 10 years ago 
without any work required to keep it up since then.

Heroku is somewhat expensive if you actually get enough traffic that you 
need to start paying them, but it's ideal for the MVP / proof-of-concept 
phase of a project. If you're price-conscious and want to scale up a bit 
more, you can rent a dedicated VM for $5/month (for example, Digital Ocean 
droplets https://www.digitalocean.com/pricing/) and that will get you a lot 
more capacity per $. That said, you may find that the convenience of Heroku 
is worth paying for.

On Sunday, October 3, 2021 at 9:27:25 AM UTC-7 avi.me...@gmail.com wrote:

> Hello! I am building a prototype Django app and would like to deploy it so 
> that people can use it.
> What would be the most cost-effective and cheapest deployment solution to 
> host a django backend? How much would it cost?
> Any ideas, help is most welcomed and appretiated
>

-- 
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/7fdd43b6-5bca-4cc1-90df-7e277d19b5d7n%40googlegroups.com.


I am using django with DRF and dj_rest_auth

2021-06-12 Thread Manas Paul

I have made my custom user model. The dj_rest_auth returning the response 
after successfull login 
{ "access_token": 
"eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ0b2tlbl90eXBlIjoiYWNjZXNzIiwiZXhwIjoxNjIzdXJfaWQiOjZ9.4yjIBxXhe5grxCe18huamgj1qP44A-zOkUHxZ61wXao"
, "refresh_token": 
"eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ0b2tlbl90eXBlIjoicmVmcmVzaCIsImV4cCI6MTYyMzU2OTMzNiwianRpIjoiODFlYzdkNjVjZjQzNDI4NjlhYjYzODI4MWUxNDQ4MjUiLCJ1c2VyX2lkIjo2fQ.1p3_Vw8OYoa64B93wHiEEiyKH3oT8M-3FGrivZmvWaA"
, 
"user": { "pk": 6, "email": "userem...@gmail.com" } }

I want the user object to have all the fields that I have defined. I could 
not get the way how I can achieve that. 

Here is the repo
https://github.com/imanaspaul/server-cg/

another problem I am getting I can register the user but when I am trying 
to login it says I can't login with the credentials [ "Unable to log in 
with provided credentials."]

-- 
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/fc55fb68-9745-4f32-9be3-1c27c038123fn%40googlegroups.com.


Re: Immediately Need Help

2021-02-19 Thread Kritika Paul
class Spaces(BaseModel):
__tablename__ = "spaces"
name = db.Column(db.String(255))
user_id = db.Column(db.Integer)
status = db.Column(
db.String(100), default=SpaceStatusType.PENDING.value)
space_category_id = db.Column(
db.Integer, db.ForeignKey("space_categories.id"))
space_company_id = db.Column(
db.Integer, db.ForeignKey("space_companies.id"))
space_detail_id = db.Column(db.Integer, db.ForeignKey("space_details.id"
))
space_broker_id = db.Column(db.Integer, db.ForeignKey("space_brokers.id"
))
space_building_particulars_id = db.Column(db.Integer, db.ForeignKey("
space_building_particulars.id"))
space_commercial_products_id = db.Column(db.Integer, db.ForeignKey("
space_commercial_products.id"))
space_document_id = db.Column(db.Integer, db.ForeignKey("
space_documents.id"))
is_deleted = db.Column(db.Boolean,default=False)
is_completed = db.Column(db.Boolean,default=False)
space_category = db.relationship("SpaceCategory", backref=db.backref(
"spaces", uselist=True, lazy="dynamic"))
space_company = db.relationship("SpaceCompany", backref=db.backref(
"spaces", uselist=True, lazy="dynamic"))
space_detail = db.relationship("SpaceDetail", backref=db.backref(
"spaces", uselist=True, lazy="dynamic"))
space_broker = db.relationship("SpaceBroker", backref=db.backref(
"spaces", uselist=True, lazy="dynamic"))
space_building_particulars = db.relationship("SpaceBuildingParticular",
backref=db.backref(
"spaces", uselist=True, lazy="dynamic"))
space_commercial_products=db.relationship("SpaceCommercialProduct",
backref=db.backref(
"spaces", uselist=True, lazy="dynamic"))
space_document=db.relationship("SpaceDocument", backref=db.backref(
"spaces", uselist=True, lazy="dynamic"))



Need to save in name field


On Fri, 19 Feb 2021 at 16:32, Chetan Ganji  wrote:

> Show the model where you save Space_code
>
> On Fri, Feb 19, 2021, 4:19 PM Kritika Paul 
> wrote:
>
>> class SpaceCategory(BaseModel):
>> __tablename__ = "space_categories"
>>
>> name = db.Column(db.String(255))
>> description = db.Column(db.Text)
>> image_url = db.Column(db.Text)
>> code = db.Column(db.String(100))
>> space_sub_category = db.relationship('SpaceSubCategory', backref
>> =db.backref("space_category", uselist=False))
>>
>> class Cities(BaseModel):
>> __tablename__ = "cities"
>> name = db.Column(db.String(255))
>> code = db.Column(db.String(100))
>> is_deleted = db.Column(db.Boolean,default=False)
>> These are the models,
>> There is one other model where I have to save Space_code
>>
>> Now, Space Category is CW,COM,MS
>> City Code is NOIDA, DELHI,KOlkata
>>
>> Space code to be generated such that Numbers should increase Space
>> Category Wise
>>
>>
>> On Fri, 19 Feb 2021 at 16:07, Chetan Ganji 
>> wrote:
>>
>>> Yes kritika show all the models.
>>>
>>> How shubham?
>>> If an entry is deleted, unique code will also be deleted. Next time it
>>> gets generated, it might be assigned to different entry, but it still be
>>> unique.
>>>
>>> As kritika clarified already, so it wont be a problem.
>>>
>>> On Fri, Feb 19, 2021, 3:58 PM shubham vashisht 
>>> wrote:
>>>
>>>> Chetan
>>>> If any row is deleted from the table, then your logic will fail to
>>>> return the unique code
>>>>
>>>> On Fri, 19 Feb 2021, 15:52 Chetan Ganji, 
>>>> wrote:
>>>>
>>>>> Hi Kritika
>>>>>
>>>>> Ye chanel mein firangi log bhi hai, unko hinglish kaisa samjhenga? 
>>>>>
>>>>> Teko field pe unique constraint lagana padenga
>>>>>
>>>>> Teko no wapas 1 se start karneke liye query maarana padenga
>>>>>
>>>>> last_no = Model.objects.filter(categorycode="blah",
>>>>> citycode="blah-blah").count()
>>>>>
>>>>> unique_code ="LM" + categorycode
>>>>> + citycode + str(last_no + 1)
>>>>>
>>>>>
>>>>> Aisa code likkha toh result milenga 
>>>>>
>>>>>
>>>>> On Fri, Feb 19, 2021, 3:31 PM Kritika Paul 
&g

Re: Immediately Need Help

2021-02-19 Thread Kritika Paul
class SpaceCategory(BaseModel):
__tablename__ = "space_categories"

name = db.Column(db.String(255))
description = db.Column(db.Text)
image_url = db.Column(db.Text)
code = db.Column(db.String(100))
space_sub_category = db.relationship('SpaceSubCategory', backref
=db.backref("space_category", uselist=False))

class Cities(BaseModel):
__tablename__ = "cities"
name = db.Column(db.String(255))
code = db.Column(db.String(100))
is_deleted = db.Column(db.Boolean,default=False)
These are the models,
There is one other model where I have to save Space_code

Now, Space Category is CW,COM,MS
City Code is NOIDA, DELHI,KOlkata

Space code to be generated such that Numbers should increase Space Category
Wise


On Fri, 19 Feb 2021 at 16:07, Chetan Ganji  wrote:

> Yes kritika show all the models.
>
> How shubham?
> If an entry is deleted, unique code will also be deleted. Next time it
> gets generated, it might be assigned to different entry, but it still be
> unique.
>
> As kritika clarified already, so it wont be a problem.
>
> On Fri, Feb 19, 2021, 3:58 PM shubham vashisht 
> wrote:
>
>> Chetan
>> If any row is deleted from the table, then your logic will fail to return
>> the unique code
>>
>> On Fri, 19 Feb 2021, 15:52 Chetan Ganji,  wrote:
>>
>>> Hi Kritika
>>>
>>> Ye chanel mein firangi log bhi hai, unko hinglish kaisa samjhenga? 
>>>
>>> Teko field pe unique constraint lagana padenga
>>>
>>> Teko no wapas 1 se start karneke liye query maarana padenga
>>>
>>> last_no = Model.objects.filter(categorycode="blah",
>>> citycode="blah-blah").count()
>>>
>>> unique_code ="LM" + categorycode
>>> + citycode + str(last_no + 1)
>>>
>>>
>>> Aisa code likkha toh result milenga 
>>>
>>>
>>> On Fri, Feb 19, 2021, 3:31 PM Kritika Paul 
>>> wrote:
>>>
>>>>  I have to create a unique code for each space saved in dbAb db me save
>>>> krne k lie, wo multiple part me save ho rha hai, multiple models bhi hai
>>>> uske.1st model se mujhe space category ka name uthana hai
>>>> 2nd se city code
>>>> Category alag alg ho skti hai
>>>> To code genrate hoga LM-categorycode-citycode-1Next time jb
>>>> category, B hogi to number 1 se hi start hoga, ni to category same hai to
>>>> fr se 2 allot ho jaega
>>>> Eg Category - CW, COM
>>>> City - Noida, DelhiSpace 1 - Cw category
>>>> Code space 1- LMCWNoida1Space2 - CW Category
>>>> CODE SPACE2 - LMCWDelhi2Space 3 - COM category
>>>> CODE SPACE 3- LM-COM-NOIDA0001
>>>>
>>>> --
>>>> 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/690debd2-46e0-497f-92a8-3abbc391b97dn%40googlegroups.com
>>>> <https://groups.google.com/d/msgid/django-users/690debd2-46e0-497f-92a8-3abbc391b97dn%40googlegroups.com?utm_medium=email_source=footer>
>>>> .
>>>>
>>> --
>>> 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/CAMKMUjs6q%2B6Xer6-MRu%3DYjhKq5EYNXahEji%2BY5HBerTaNQ1Law%40mail.gmail.com
>>> <https://groups.google.com/d/msgid/django-users/CAMKMUjs6q%2B6Xer6-MRu%3DYjhKq5EYNXahEji%2BY5HBerTaNQ1Law%40mail.gmail.com?utm_medium=email_source=footer>
>>> .
>>>
>> --
>> 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/CAJW_r64v1-f85ViX%2BnCFdBrupiXi5Ba%3Dzec6xoSvuZnR1jaMEg%40mail.gmail.com
>> <https://groups.google.com/d/msgid/django-users/CAJW_r64v1-f85ViX%2BnCFdBrupiXi5Ba%3Dzec6xoSvuZnR1jaMEg%40mail.gmail.com?utm_medium=email_source=footer>
>> .
>>

Re: Immediately Need Help

2021-02-19 Thread Kritika Paul
No row will be deleted, also, the code created once will never be assigned
to any other space

On Fri, 19 Feb 2021 at 15:59, shubham vashisht  wrote:

> Chetan
> If any row is deleted from the table, then your logic will fail to return
> the unique code
>
> On Fri, 19 Feb 2021, 15:52 Chetan Ganji,  wrote:
>
>> Hi Kritika
>>
>> Ye chanel mein firangi log bhi hai, unko hinglish kaisa samjhenga? 
>>
>> Teko field pe unique constraint lagana padenga
>>
>> Teko no wapas 1 se start karneke liye query maarana padenga
>>
>> last_no = Model.objects.filter(categorycode="blah",
>> citycode="blah-blah").count()
>>
>> unique_code ="LM" + categorycode
>> + citycode + str(last_no + 1)
>>
>>
>> Aisa code likkha toh result milenga 
>>
>>
>> On Fri, Feb 19, 2021, 3:31 PM Kritika Paul 
>> wrote:
>>
>>>  I have to create a unique code for each space saved in dbAb db me save
>>> krne k lie, wo multiple part me save ho rha hai, multiple models bhi hai
>>> uske.1st model se mujhe space category ka name uthana hai
>>> 2nd se city code
>>> Category alag alg ho skti hai
>>> To code genrate hoga LM-categorycode-citycode-1Next time jb
>>> category, B hogi to number 1 se hi start hoga, ni to category same hai to
>>> fr se 2 allot ho jaega
>>> Eg Category - CW, COM
>>> City - Noida, DelhiSpace 1 - Cw category
>>> Code space 1- LMCWNoida1Space2 - CW Category
>>> CODE SPACE2 - LMCWDelhi2Space 3 - COM category
>>> CODE SPACE 3- LM-COM-NOIDA0001
>>>
>>> --
>>> 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/690debd2-46e0-497f-92a8-3abbc391b97dn%40googlegroups.com
>>> <https://groups.google.com/d/msgid/django-users/690debd2-46e0-497f-92a8-3abbc391b97dn%40googlegroups.com?utm_medium=email_source=footer>
>>> .
>>>
>> --
>> 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/CAMKMUjs6q%2B6Xer6-MRu%3DYjhKq5EYNXahEji%2BY5HBerTaNQ1Law%40mail.gmail.com
>> <https://groups.google.com/d/msgid/django-users/CAMKMUjs6q%2B6Xer6-MRu%3DYjhKq5EYNXahEji%2BY5HBerTaNQ1Law%40mail.gmail.com?utm_medium=email_source=footer>
>> .
>>
> --
> 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/CAJW_r64v1-f85ViX%2BnCFdBrupiXi5Ba%3Dzec6xoSvuZnR1jaMEg%40mail.gmail.com
> <https://groups.google.com/d/msgid/django-users/CAJW_r64v1-f85ViX%2BnCFdBrupiXi5Ba%3Dzec6xoSvuZnR1jaMEg%40mail.gmail.com?utm_medium=email_source=footer>
> .
>


-- 
Regards,

Kritika Paul
rkritikapau...@gmail.com
+91-7905147674

-- 
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%2BQJGq4U2sE_K10Y_EbG_T9bCPnHeQcMfJ-11Ji5MDd%2B6g8AAw%40mail.gmail.com.


Re: Immediately Need Help

2021-02-19 Thread Kritika Paul
I need to fetch it from different models. If you want I can share models
snapshot

On Fri, 19 Feb 2021 at 15:52, Chetan Ganji  wrote:

> Hi Kritika
>
> Ye chanel mein firangi log bhi hai, unko hinglish kaisa samjhenga? 
>
> Teko field pe unique constraint lagana padenga
>
> Teko no wapas 1 se start karneke liye query maarana padenga
>
> last_no = Model.objects.filter(categorycode="blah",
> citycode="blah-blah").count()
>
> unique_code ="LM" + categorycode
> + citycode + str(last_no + 1)
>
>
> Aisa code likkha toh result milenga 
>
>
> On Fri, Feb 19, 2021, 3:31 PM Kritika Paul 
> wrote:
>
>>  I have to create a unique code for each space saved in dbAb db me save
>> krne k lie, wo multiple part me save ho rha hai, multiple models bhi hai
>> uske.1st model se mujhe space category ka name uthana hai
>> 2nd se city code
>> Category alag alg ho skti hai
>> To code genrate hoga LM-categorycode-citycode-1Next time jb category,
>> B hogi to number 1 se hi start hoga, ni to category same hai to fr se 2
>> allot ho jaega
>> Eg Category - CW, COM
>> City - Noida, DelhiSpace 1 - Cw category
>> Code space 1- LMCWNoida1Space2 - CW Category
>> CODE SPACE2 - LMCWDelhi2Space 3 - COM category
>> CODE SPACE 3- LM-COM-NOIDA0001
>>
>> --
>> 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/690debd2-46e0-497f-92a8-3abbc391b97dn%40googlegroups.com
>> <https://groups.google.com/d/msgid/django-users/690debd2-46e0-497f-92a8-3abbc391b97dn%40googlegroups.com?utm_medium=email_source=footer>
>> .
>>
> --
> 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/CAMKMUjs6q%2B6Xer6-MRu%3DYjhKq5EYNXahEji%2BY5HBerTaNQ1Law%40mail.gmail.com
> <https://groups.google.com/d/msgid/django-users/CAMKMUjs6q%2B6Xer6-MRu%3DYjhKq5EYNXahEji%2BY5HBerTaNQ1Law%40mail.gmail.com?utm_medium=email_source=footer>
> .
>


-- 
Regards,

Kritika Paul
rkritikapau...@gmail.com
+91-7905147674

-- 
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%2BQJGq4MRsKMYkaUZh1u-Phxk4QOG1g%3DYZWf7QGUGiqEXfFjXA%40mail.gmail.com.


Immediately Need Help

2021-02-19 Thread Kritika Paul
 I have to create a unique code for each space saved in dbAb db me save 
krne k lie, wo multiple part me save ho rha hai, multiple models bhi hai 
uske.1st model se mujhe space category ka name uthana hai
2nd se city code
Category alag alg ho skti hai
To code genrate hoga LM-categorycode-citycode-1Next time jb category, B 
hogi to number 1 se hi start hoga, ni to category same hai to fr se 2 allot 
ho jaega
Eg Category - CW, COM
City - Noida, DelhiSpace 1 - Cw category
Code space 1- LMCWNoida1Space2 - CW Category
CODE SPACE2 - LMCWDelhi2Space 3 - COM category
CODE SPACE 3- LM-COM-NOIDA0001

-- 
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/690debd2-46e0-497f-92a8-3abbc391b97dn%40googlegroups.com.


Project setup

2020-09-04 Thread Kritika Paul
Hi

I am a beginner to django and trying to create a full fledged school
management system on django.
I need someone to help in setting up the project from base.
Basic ideas like from which module to start.

Also,i need to create 4 different roles apart from superadmin, how to
create those.
Please someone reply soon.
-- 
Regards,

Kritika Paul
rkritikapau...@gmail.com
+91-7905147674

-- 
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%2BQJGq7sHJ7korE%2BmsUiQ34%2Bmtx0vc_6bj-u6EtdENOFP3Mp2Q%40mail.gmail.com.


What will be best option

2020-08-14 Thread Manas Paul
I have been working on a project, where the project has a Model called 
Competition and under each completion I have a model called  Artwork ( in 
foreign key relationship). I am using DRF and the problem I am facing is 
each artwork has a field called approved ( boolean ) and I want to retrieve 
all the approved artwork under a competition detail view. 

How can I filter that data on Competition retrieve API view. I could not 
find any good example. Please help

Also I have been thinking about to make another api which will filter the 
artwork only based on the given competition id.

Please help me to find out the solution.

-- 
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/6ca48241-fd2c-473e-afd5-f9f09b901703n%40googlegroups.com.


Re: HOW TO REDIRECT DIFFERENT CATEGORY OF USERS THROUGH LOGIN REDIRECT (two login redirects instead of one)

2020-07-12 Thread Kuntal Paul
Thanks a lot for help. That worked.

On Sat, Jul 11, 2020, 11:47 PM oba stephen  wrote:

> It should work.
>
> Try the link Damanjeet shared.
> If you still get an error, share the error message.
>
> On Sat, Jul 11, 2020 at 6:57 PM Damanjeet Singh 
> wrote:
>
>> Please check this answer
>> https://stackoverflow.com/questions/16824004/django-conditional-login-redirect
>>
>> On Sat, 11 Jul 2020, 18:22 Kuntal Paul,  wrote:
>>
>>> Thank you for your response. I did this way and it was giving me a 405
>>> error. I couldn't find my mistake. I was saving both of them as student and
>>> as teacher separately from auth.user.
>>>  Also, do I have to provide a separate temple for that view?
>>>
>>>
>>> On Sat, Jul 11, 2020, 10:41 PM oba stephen 
>>> wrote:
>>>
>>>> You can consider redirecting to a URL that handles the request.
>>>>
>>>> That is a View function that checks if the user is a student or
>>>> teacher, then renders the respective profiles.
>>>>
>>>> Regards
>>>>
>>>> On Sat, Jul 11, 2020 at 5:58 PM Kuntal Paul 
>>>> wrote:
>>>>
>>>>> The *LOGIN_REDIRECT_URL*  only allowing to redirect to a particular
>>>>> profile page. But in scenarios like where there are *students* and
>>>>> *teachers*, both of them need their specific profile page after
>>>>> login.
>>>>>
>>>>> Using* LOGIN_REDIRECT_URL*, both the teachers and the students are
>>>>> getting redirected to the same profile ( in my case, both of them either
>>>>> entirely to teachers profile or entirely to students profile).
>>>>>
>>>>> How can I set *two login redirects instead of one*? I searched in the
>>>>> documentation, online videos, and everything but couldn't find such. 
>>>>> Please
>>>>> help me with resources/codes/guide/etc from where I can learn from and
>>>>> implement. I'm pretty new to this and have tried whatever I know till now.
>>>>>
>>>>> 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/e185b4ba-2219-4a1b-bba2-8ef4e4466682o%40googlegroups.com
>>>>> <https://groups.google.com/d/msgid/django-users/e185b4ba-2219-4a1b-bba2-8ef4e4466682o%40googlegroups.com?utm_medium=email_source=footer>
>>>>> .
>>>>>
>>>> --
>>>> 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/CAAJsLnqfSPy0VEjpv9TrPS-qcFTWjrtQqhFMMQs8B6qqUX5XOw%40mail.gmail.com
>>>> <https://groups.google.com/d/msgid/django-users/CAAJsLnqfSPy0VEjpv9TrPS-qcFTWjrtQqhFMMQs8B6qqUX5XOw%40mail.gmail.com?utm_medium=email_source=footer>
>>>> .
>>>>
>>> --
>>> 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/CABD8006ftC%3DtPyk%2BFWikZ0mGLGpiNBnFicU6eq2cL-mRcO-LbA%40mail.gmail.com
>>> <https://groups.google.com/d/msgid/django-users/CABD8006ftC%3DtPyk%2BFWikZ0mGLGpiNBnFicU6eq2cL-mRcO-LbA%40mail.gmail.com?utm_medium=email_source=footer>
>>> .
>>>
>> --
>> 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/CAGLHGi4c2yJju-91NAivt_gOeoD%3DyhaUq___VjEuUnADrtoyNw%40mail.gmail.com
>> <https://g

Re: HOW TO REDIRECT DIFFERENT CATEGORY OF USERS THROUGH LOGIN REDIRECT (two login redirects instead of one)

2020-07-11 Thread Kuntal Paul
Thank you for your response. I did this way and it was giving me a 405
error. I couldn't find my mistake. I was saving both of them as student and
as teacher separately from auth.user.
 Also, do I have to provide a separate temple for that view?


On Sat, Jul 11, 2020, 10:41 PM oba stephen  wrote:

> You can consider redirecting to a URL that handles the request.
>
> That is a View function that checks if the user is a student or teacher,
> then renders the respective profiles.
>
> Regards
>
> On Sat, Jul 11, 2020 at 5:58 PM Kuntal Paul  wrote:
>
>> The *LOGIN_REDIRECT_URL*  only allowing to redirect to a particular
>> profile page. But in scenarios like where there are *students* and
>> *teachers*, both of them need their specific profile page after login.
>>
>> Using* LOGIN_REDIRECT_URL*, both the teachers and the students are
>> getting redirected to the same profile ( in my case, both of them either
>> entirely to teachers profile or entirely to students profile).
>>
>> How can I set *two login redirects instead of one*? I searched in the
>> documentation, online videos, and everything but couldn't find such. Please
>> help me with resources/codes/guide/etc from where I can learn from and
>> implement. I'm pretty new to this and have tried whatever I know till now.
>>
>> 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/e185b4ba-2219-4a1b-bba2-8ef4e4466682o%40googlegroups.com
>> <https://groups.google.com/d/msgid/django-users/e185b4ba-2219-4a1b-bba2-8ef4e4466682o%40googlegroups.com?utm_medium=email_source=footer>
>> .
>>
> --
> 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/CAAJsLnqfSPy0VEjpv9TrPS-qcFTWjrtQqhFMMQs8B6qqUX5XOw%40mail.gmail.com
> <https://groups.google.com/d/msgid/django-users/CAAJsLnqfSPy0VEjpv9TrPS-qcFTWjrtQqhFMMQs8B6qqUX5XOw%40mail.gmail.com?utm_medium=email_source=footer>
> .
>

-- 
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/CABD8006ftC%3DtPyk%2BFWikZ0mGLGpiNBnFicU6eq2cL-mRcO-LbA%40mail.gmail.com.


HOW TO REDIRECT DIFFERENT CATEGORY OF USERS THROUGH LOGIN REDIRECT (two login redirects instead of one)

2020-07-11 Thread Kuntal Paul
The *LOGIN_REDIRECT_URL*  only allowing to redirect to a particular profile 
page. But in scenarios like where there are *students* and *teachers*, both 
of them need their specific profile page after login. 

Using* LOGIN_REDIRECT_URL*, both the teachers and the students are getting 
redirected to the same profile ( in my case, both of them either entirely 
to teachers profile or entirely to students profile). 

How can I set *two login redirects instead of one*? I searched in the 
documentation, online videos, and everything but couldn't find such. Please 
help me with resources/codes/guide/etc from where I can learn from and 
implement. I'm pretty new to this and have tried whatever I know till now.

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/e185b4ba-2219-4a1b-bba2-8ef4e4466682o%40googlegroups.com.


Re: Python Django Training

2020-02-03 Thread Manas Paul
Hope this help you a lot to learn django in depth https://manascode.com/

On Saturday, 1 February 2020 19:12:52 UTC+5:30, Srikanth K wrote:
>
> Hi,
>
> I am from Hyderabad. I am Python Developer by Profession. I am eager take 
> up any Python , Django Training (online Preferrable or Weekends). Members 
> who require can contact me or share me  there idea.
>
> Regards,
> Srikanth.K
>

-- 
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/bafb874b-e6ca-4de5-a8dd-d0054a83d867%40googlegroups.com.


Re: using Django to create/build enterprise e-commerce system

2020-02-03 Thread Manas Paul
Contact at cont...@manacode.com

On Saturday, 1 February 2020 22:43:29 UTC+5:30, Henry Udoye wrote:
>
> I need the following: 
>
> *ENTERPRISE E-COMMERCE APPLICATIONS COMPONENTS OUTLINED OR MENTIONED OR 
> LISTED BELOW AND THE ENTERPRISE E-COMMERCE APPLICATIONS COMPONENTS 
> INTEGRATOR(S) TO PUT OR GLUE THEM TOGETHER.*
>
> Custom web applications (including e-commerce applications or components 
> and/or software development)
>
> Search product or engine or crawler or spider or intelligent agent
>
> Connector or connectivity or connection (to the database)
>
> Database
>
> Analytics or query tool or data modeler
>
> Content creator or aggregator or composition or article or content writer 
> or chief spinner
>
> API Creator
>
> API Integrator or connector
>
> API Manager
>
> Opt-in tool
>
> Auto-responder or auto-responding/ email marketing 
>
> Record tracking tool
>
> Payment method or gateway or payment processing system
>
> Automation and/or scripting creation or generation tool
>
> Auto-posting
>
> Auto-retrieval
>
> Auto-extraction
>
> Auto-blogging and
>
> Custom API server with multiple end points and multiple clients. 
>
> Enterprise E-Commerce Applications Components System Integrator(s).
>
> 14000 to 15000 APIs Catalog or Repository
>
> NOTE: We have all or the entire E-Commerce applications components such 
> that with proper sense of flexibility, extensibility, interoperability, 
> integration and the related these components can be put together as a 
> component-based e-commerce architecture. Given that these components are 
> earmarked, mentioned, outlined and enumerated in the documents and are 
> standard IT products I expect a professional to be able to understand and 
> estimate (time and money) the project.
>
>  
>

-- 
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/141af8fd-9fae-42e0-a43a-19da0678083a%40googlegroups.com.


Django - Heavy Databse Usage

2019-11-18 Thread Paul Onteri
Let's say you are building a SAAS application system in which every user 
will use the database heavily, for example, a hospital management system. 
Should you have separate databases for each user? And how do you implement 
this in 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/c8b1fac4-bf7f-48a3-b135-88f73f2d2eb1%40googlegroups.com.


Re: JSONField filter fails with TypeError: can only concatenate tuple (not "list") to tuple

2019-11-12 Thread John-Paul Navarro
Django 2.2.7 fixed the problem.

Thanks!

On Friday, November 1, 2019 at 4:59:11 PM UTC-5, Raffaele Salmaso wrote:
>
> On Fri, Nov 1, 2019 at 10:38 PM John-Paul Navarro  > wrote:
>
>> The following fails with Django 2.2.6 but works with Django 1.11.x.
>>
> https://code.djangoproject.com/ticket/30826
>
> -- 
> | Raffaele Salmaso
> | https://salmaso.org
> | https://bitbucket.org/rsalmaso
> | https://github.com/rsalmaso
>

-- 
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/2a8c9b12-bfbc-46e0-b197-3fa28145a5f9%40googlegroups.com.


JSONField filter fails with TypeError: can only concatenate tuple (not "list") to tuple

2019-11-01 Thread John-Paul Navarro
The following fails with Django 2.2.6 but works with Django 1.11.x.

Did filter() of JSONfield change in 2.2.6 and the query needs to change, or 
could this be a bug?

Goal:
   Select model rows where the related AbstractService.EntityJSON contents 
“Capability" list includes the value 'data.transfer.nonstriped'
Given: EntityJSON field contains "Capability": ["data.transfer.striped", 
"data.transfer.nonstriped"],

Executing:
  objects = 
Endpoint.objects.filter(AbstractService__EntityJSON__Capability__contains=['data.transfer.nonstriped’])
  serializernonstriped = xdinfo_gridftpn_Serializer(objects, many=True)
  len(serializernonstriped.data)

Failes like this:
(Pdb) n
> 
/soft/python-pipenv/python-201910-zz_fwp56/lib/python3.7/site-packages/django/contrib/postgres/lookups.py(11)as_sql()
-> params = lhs_params + rhs_params
(Pdb) n
TypeError: can only concatenate tuple (not "list") to tuple
> 
/soft/python-pipenv/python-201910-zz_fwp56/lib/python3.7/site-packages/django/contrib/postgres/lookups.py(11)as_sql()
-> params = lhs_params + rhs_params
(Pdb) l
  6   
  7   class PostgresSimpleLookup(Lookup):
  8  def as_sql(self, qn, connection):
  9  lhs, lhs_params = self.process_lhs(qn, connection)
 10  rhs, rhs_params = self.process_rhs(qn, connection)
 11  ->params = lhs_params + rhs_params
 12  return '%s %s %s' % (lhs, self.operator, rhs), params
 13   
 14   
 15   class DataContains(PostgresSimpleLookup):
 16  lookup_name = 'contains'
(Pdb) lhs, lhs_params
('("glue2_db_abstractservice"."EntityJSON" -> %s)', ('Capability',))
(Pdb) rhs, rhs_params
('%s', [])


Models:
class AbstractGlue2EntityModel(models.Model):
ID = models.CharField(primary_key=True, max_length=200)
Name = models.CharField(max_length=128, null=True)
CreationTime = models.DateTimeField()
Validity = models.DurationField(null=True)
EntityJSON = JSONField()
class Meta:
abstract = True
db_name = 'glue2'
def __str__(self):
return str(self.ID)
class AbstractService(AbstractGlue2EntityModel):
ResourceID = models.CharField(db_index=True, max_length=40)
ServiceType = models.CharField(max_length=32)
Type = models.CharField(max_length=32)
QualityLevel = models.CharField(max_length=16, null=True)

class Endpoint(AbstractGlue2EntityModel):
ResourceID = models.CharField(db_index=True, max_length=40)
AbstractService = models.ForeignKey(AbstractService,
related_name='endpoints',
on_delete=models.CASCADE,
null=True)
HealthState = models.CharField(max_length=16)
ServingState = models.CharField(max_length=16)
URL = models.CharField(max_length=320)
QualityLevel = models.CharField(max_length=16, null=True)
InterfaceVersion = models.CharField(max_length=16)
InterfaceName = models.CharField(max_length=32)



-- 
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/2ded869b-4706-47f7-aba3-f6c290ccb719%40googlegroups.com.


Re: list records of another app in another app

2019-09-24 Thread Paul Barber
I was actually thinking of doing the same thing

On Tuesday, September 24, 2019 at 3:10:46 PM UTC-4, Perceval Maturure wrote:
>
>
> Hi awesome django users
> i want to list model records of App1 in  a detail view of App2
> any ideas?
> Regards
>
> -- 
> *Perceval Maturure*
>
> *083 303 9423*
>

-- 
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/ee7c5ea4-a109-4e63-a581-394e1dcc96cc%40googlegroups.com.


Re: Collapsible elements in admin stopped working with latest release

2019-07-12 Thread Paul Michalski


I can confirm this bug also occurs when using the minified file, 
collapse.min.js. I just updated our production server and the same bug 
popped up. 

-- 
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/bb09487f-f874-4da7-87bd-73388ddb3cf0%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Collapsible elements in admin stopped working with latest release

2019-07-12 Thread Paul Michalski
I just upgraded from Django 2.1.3 to 2.2.3, at which point collapsible
elements in the admin interface stopped working. I’m using IE11, and in the
console I see the error “object doesn't support property or method
'matches'”, with a reference to line 35 of collapse.js in the admin
package. I did some research and I found that IE11 doesn’t support the
“matches” function, so I just modified the admin base template with a
polyfill to get things working on my machine. But the collapsible elements
were working fine with my old version of Django on IE11, so it looks like a
polyfill (or something) was removed in the most recent Django version. Does
anyone know what might have changed? If something was changed, I think this
is a bug – we shouldn’t have to modify the templates in the admin package
to use IE11.



This is my first post. Thanks for any comments or suggestions.


Paul

-- 
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/CAP-Fw1EC3t-%2BR86BWsJ0SvLUg1-45epCQPZzY4H6Kg2tXJtYnQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


If you run my server code

2019-07-10 Thread Paul Gureghian
do you get redirected to a results page after voting in the poll ?

my /Django repo. 

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/154c44ac-a06b-449d-94ec-ea59de19b3e1%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: How to set timezone in Django.

2019-07-09 Thread Paul Gureghian
I used  "America / Los_Angeles , and it worked. thanks 

On Tuesday, July 9, 2019 at 1:43:20 PM UTC-7, M. A wrote:
>
> 'PST' is not available in pytz
>
> The Pacific available timezones are :
>
> 'PST8PDT'
> 'Pacific/Apia'
> 'Pacific/Auckland'
> 'Pacific/Bougainville'
> 'Pacific/Chatham'
> 'Pacific/Chuuk'
> 'Pacific/Easter'
> 'Pacific/Efate'
> 'Pacific/Enderbury'
> 'Pacific/Fakaofo'
> 'Pacific/Fiji'
> 'Pacific/Funafuti'
> 'Pacific/Galapagos'
> 'Pacific/Gambier'
> 'Pacific/Guadalcanal'
> 'Pacific/Guam'
> 'Pacific/Honolulu'
> 'Pacific/Johnston'
> 'Pacific/Kiritimati'
> 'Pacific/Kosrae'
> 'Pacific/Kwajalein'
> 'Pacific/Majuro'
> 'Pacific/Marquesas'
> 'Pacific/Midway'
> 'Pacific/Nauru'
> 'Pacific/Niue'
> 'Pacific/Norfolk'
> 'Pacific/Noumea'
> 'Pacific/Pago_Pago'
> 'Pacific/Palau'
> 'Pacific/Pitcairn'
> 'Pacific/Pohnpei'
> 'Pacific/Ponape'
> 'Pacific/Port_Moresby'
> 'Pacific/Rarotonga'
> 'Pacific/Saipan'
> 'Pacific/Samoa'
> 'Pacific/Tahiti'
> 'Pacific/Tarawa'
> 'Pacific/Tongatapu'
> 'Pacific/Truk'
> 'Pacific/Wake'
> 'Pacific/Wallis'
> 'Pacific/Yap'
>
>

-- 
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/ce788c0a-acba-4675-b637-4cce3104b1ad%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Hi

2019-07-09 Thread Paul Gureghian
Can I ask a Django question here ?

-- 
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/52b66249-0aa7-4b9b-89d7-a53cb859245a%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


How to set timezone in Django.

2019-07-09 Thread Paul Gureghian
Specifically in the official 'polls' tutorial from the docs.  

In the 'mysite.settings.py' file.  I changed from 'UTC'  to  'PST' and 
'pst' and both faulted. 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/acfc14aa-21a9-4321-b056-01f4d35a3792%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


template {% url %} tag is giving server's absolute path

2018-12-27 Thread Paul Lanza
I have recently changed my django project (using A2 hosting) from fcgi to 
wsgi.  I have successfully gotten the project to work, but I am 
experiencing a minor caveat I am trying to solve.  Now, when I use the {% 
url %} tag in the templates to form a link, I get the absolute path of the 
server (the results still works but the link now looks more ugly).

For example, I might have this in my urls.py

url("^about_us/$", views.about_us, name="about_us")


Then in my template, I would have this

{% url "about_us" %}


In my development, the template will render the link "/about_us" so that 
when you click the link, it takes you to www.mysite.com/about_us.html

Now, in production, the template will render the link 
"/home/myproject/myproject/about_us" so that when you click the link, it 
takes you to www.mysite.com/home/myproject/myproject/about_us.html

How can I get my production template rendering of the url tag to replicate 
the development rendering of the url tag.

Thanks for any help!

-- 
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/cbdad29b-7048-48ac-82e8-f807bcd3bf22%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Django Channels - core.py error

2018-11-06 Thread Paul Whipp
I've just had trouble with exactly the same error. In my case I was 
building from the tutorial ChatConsumer with my own XChatConsumer and I 
hadn't referenced it in the routing.py. As a result the tutorial async chat 
consumer was receiving a scope that did not contain a room_name in its 
url_route kwargs. Very obscure! I think the channel gets closed by an error 
and then this 500 error comes up rather than anything helpful for the 
original error.

On Friday, 12 October 2018 07:06:13 UTC+10, itsnate_b wrote:
>
> Hi Simon,
>
> Sorry to hear that you are having the same problem! Channels can be a 
> blessing and a curse. I find it very finicky with very poor documentation & 
> poor error handling. As for the fix: I had an AsyncWebsocketConsumer class 
> in consumers.py within which I had a custom __init__ function. I believe I 
> was setting the scope incorrectly within the init. I realized that I had no 
> need to override/augment the init and removed it. The result was that the 
> error disappeared. That was it for me. I have since updated to all the 
> latest builds for the channels & redis infrastructure.
>
> Hope that helps.
>
> Cheers,
> Nathan
>
> On Tuesday, October 9, 2018 at 9:59:33 AM UTC-4, Simon Vézina wrote:
>>
>> Hi itsnate_b,
>>
>> Would you mind elaborating on your fix?
>>
>> I'm getting this exact error and I'm at a complete loss.   Everything 
>> works fine in local, but on my live server, after a couple of minutes/hours 
>> of working fine, I start getting this error in the logs.
>>
>> Thanks!
>>
>> Le dimanche 2 septembre 2018 13:26:29 UTC-4, itsnate_b a écrit :
>>>
>>> Turns out there was an erroneous *init* function in the 
>>> AsyncWebsocketConsumer class. Removing it fixed the 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 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/e1ebd5c9-5326-4d03-9512-f6f1deec28a3%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Handling multiple timezones in Django Admin

2018-10-02 Thread Paul Tiplady
Timezone handling in the Django admin is quite confusing when there are 
users in multiple timezones -- does anyone have a good way of handling this?

I'm using USE_TZ=True, TIME_ZONE='UTC', USE_I18N, USE_L10N. I have admin 
users in US/Pacific and US/Eastern.

When viewing a datetime field, users see the UTC time, with a note below 
saying "Note: You are 7 hours behind server time". This is better than 
nothing, but still quite sub-par for a 201x-era web UI. We really should be 
localizing the timezones in the browser to the user's own time zone, and 
submitting back to the app using TZ-aware timestamp strings. (It's possible 
to pull the TZ unambiguously from a modern 
browser: https://stackoverflow.com/a/37512371/37481).

Any suggestions for getting round this? I'm wondering if there's a good 
tz-aware datetime widget for the admin? Or perhaps a clean way of storing a 
User.time_zone config property that could be used to localize the admin 
cleanly.

Cheers,
Paul

-- 
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/36a1bd2c-490d-4ad8-86f6-0af5425bb7f2%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Security Check in Django

2018-06-20 Thread Jerrina Paul


Hi,

We started migrating a java project to Django .Our present code we are 
using  different filters for security. Mainly we are checking below filters

·   Session hijacking check

·   XSS attach check

·   CSRF check

·   Path manipulation check(directory traversal attack)

·   Access controller check

When I go through Django security documents ,I come across CSRF ,Session 
and XSS security. I would like to know  remaining security checks are 
already implemented in Django or we need to add our own check condition. We 
are not using Django templates for GUI .If we are adding angularJS for GUI, 
do we need to handle XSS security separately .


Regards,

Jerrina 

-- 
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/8ec14fa5-a9cd-4f2f-96c8-ca42036c79da%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


about the integration of Django with ionic

2018-05-29 Thread sujan paul
I am a beginner in using Django and i'm integrating it to my ionic 
application . I have the python code and Ionic application but i need to 
know how can i integrate each other

-- 
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/5dc6ac2b-d4de-4105-9ce2-c9729f943b05%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re:

2018-05-05 Thread Paul Baforh
alright!! No problem!! feel free

On Thu, May 3, 2018 at 12:26 PM, Muwanguzi Derrick <
muwanguziderri...@gmail.com> wrote:

> Hlo am a new django user I want be your friend for help
>
> --
> 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/CAKMyrdAxS6y%2BOmzb7cpiA9yn0-
> wLGa4HNV%2BDgu6sfHSYQpdwYw%40mail.gmail.com
> 
> .
> 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/CAOXXhvYwu0O5bKO%3D8nx8yW2%2ByS8hrwyFoMiaP17z7kBKySFaVA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: A first time programmer

2018-04-17 Thread Paul Baforh
Thanks everyone for your replies so far.  I have another prob: I'm trying to 
create a new file (.py) in my app using vscode but I get the error "permission 
denied writing to file" then followed by the directory of the base file 

-- 
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/bb4f1939-bf99-4d1f-8fa2-c1173c30bd76%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


no styling

2018-04-09 Thread Paul Baforh
Please, my django development page is without css. How do I go about it. 
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/8ff37f92-652c-4380-88fa-67b609147638%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


A first time programmer

2018-04-06 Thread Paul Baforh
Please programmers, how do I engage django because i get syntax error i 
type in this code
- $ django-admin startproject mySite ---

-- 
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/8c30cd6f-0745-44cf-a782-3cac82762a75%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: In the Admin, Is it possible to make filters on foreign keys usable with lots of related objects?

2018-02-02 Thread Paul Tiplady
I've used that in a few admin pages, as far a I understand it just
restricts the allowed values for a model's foreignkey field when editing a
model instance. I don't see any way to use that to change how the
`list_filter` functions -- am I missing something?

Thanks,
Paul

On Fri, Feb 2, 2018 at 3:57 PM, Mike Dewhirst <mi...@dewhirst.com.au> wrote:

> On 3/02/2018 5:23 AM, Paul Tiplady wrote:
>
>> Currently it's simple to configure a filter on a foreign key in the admin:
>>
>> `list_filter = ['theforeignkeyfield']`
>>
>> However in practice this is barely usable in most cases that I've
>> encountered, since the admin uses RelatedFieldListFilter, which fetches the
>> full list of objects from the DB and loads them into the browser. For any
>> production site that either times out or makes the admin unusably slow, not
>> to mention the UX is terrible as it inserts a list of all of the items into
>> the filter bar that needs to be scrolled through.
>>
>> I'm not sure if this is fixed in 2.0 (I haven't played with the new
>> select2 integration that was added), but is there a plugin / workaround to
>> use something like django-autocomplete-light, or a `raw_id_field` type
>> approach in pre-2.0?
>>
>
> Have you looked at  ...
>
> https://docs.djangoproject.com/en/1.11/ref/contrib/admin/#
> django.contrib.admin.ModelAdmin.formfield_for_foreignkey
>
> M
>
>
> --
>> 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 > django-users+unsubscr...@googlegroups.com>.
>> To post to this group, send email to django-users@googlegroups.com
>> <mailto: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/ms
>> gid/django-users/4e610074-ff8c-494d-977e-cf701c8cd92f%40googlegroups.com
>> <https://groups.google.com/d/msgid/django-users/4e610074-ff8
>> c-494d-977e-cf701c8cd92f%40googlegroups.com?utm_medium=email
>> _source=footer>.
>> For more options, visit https://groups.google.com/d/optout.
>>
>
> --
> You received this message because you are subscribed to a topic in the
> Google Groups "Django users" group.
> To unsubscribe from this topic, visit https://groups.google.com/d/to
> pic/django-users/j2pDXmEGvJE/unsubscribe.
> To unsubscribe from this group and all its topics, 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/ms
> gid/django-users/89fd33b4-c8fb-09ac-1f0b-296f82463f55%40dewhirst.com.au.
>
> 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/CAA%2BchP8RGR8HtC61bSAftMcexhQigLZsxy-tVd3T5jmz8P_HQg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: In the Admin, Is it possible to make filters on foreign keys usable with lots of related objects?

2018-02-02 Thread Paul Tiplady
That's a pretty inflexible solution though; what if I want to filter on
multiple foreign keys, e.g. Tenant=Foo(id=1), Customer=Bar(id=200)?

On Fri, Feb 2, 2018 at 12:57 PM, Andy  wrote:

> You should rather use search_fields instead of filtering together with the
> sorting ability of the admin. Thats much more suited for a scenario like
> described above.
> The filter is for status fields or something with just a few different
> entries, otherwise build your own filter to filter for some specific values.
>
> --
> You received this message because you are subscribed to a topic in the
> Google Groups "Django users" group.
> To unsubscribe from this topic, visit https://groups.google.com/d/
> topic/django-users/j2pDXmEGvJE/unsubscribe.
> To unsubscribe from this group and all its topics, 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/1ffa9984-7775-49d1-bc78-6dd2de7fcf5d%40googlegroups.com
> 
> .
>
> 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/CAA%2BchP-6LhZhu3g13Zv4g%3D9qOywB8E9HhVJPnA-%3DTe0jB1JpNQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Newbie - Microservice in Django - Best place to start learning

2018-02-02 Thread Paul Tiplady
Assuming you're trying to build a REST API and not a HTML website, you 
should look at http://www.django-rest-framework.org/ as it provides a lot 
of djangonic convenience methods for building REST APIs with the Django ORM.

On Thursday, February 1, 2018 at 9:16:47 AM UTC-8, pratibha sharma wrote:
>
> Hi,
>
> I have created 2 example websites in Django i.e. Voting and event booking 
> systems. 
> I want to learn to create microservice in Django. I took below example for 
> it.
>
> Service will 
> 1. take data from UI (it will send it in JSON format), 
> 2. store data in DB(MySQL)
> 3. Send Data to a device (in JSON format)
>
> My mind is flooded with questions like 
> how UI and service with communicate? 
> how can service communicate to device? etc.
>
> I am not sure where should I start and how to create the design for this 
> work. I am new in microservice and some experience in django.
>
> Please guide 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 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/ee24fd34-b612-4d79-8980-c79fbd4e54bf%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


In the Admin, Is it possible to make filters on foreign keys usable with lots of related objects?

2018-02-02 Thread Paul Tiplady
Currently it's simple to configure a filter on a foreign key in the admin:

`list_filter = ['theforeignkeyfield']`

However in practice this is barely usable in most cases that I've 
encountered, since the admin uses RelatedFieldListFilter, which fetches the 
full list of objects from the DB and loads them into the browser. For any 
production site that either times out or makes the admin unusably slow, not 
to mention the UX is terrible as it inserts a list of all of the items into 
the filter bar that needs to be scrolled through.

I'm not sure if this is fixed in 2.0 (I haven't played with the new select2 
integration that was added), but is there a plugin / workaround to use 
something like django-autocomplete-light, or a `raw_id_field` type approach 
in pre-2.0?

-- 
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/4e610074-ff8c-494d-977e-cf701c8cd92f%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


InlineFormset Updating issues, after changing the value in the input

2018-01-18 Thread Paul


I have 2 models Product and Image:

class Image(models.Model):
product = models.ForeignKey(Product, related_name='images', on_delete=
models.CASCADE)
parent = models.ForeignKey('self', blank=True, null=True, 
verbose_name='original 
image', on_delete=models.CASCADE)
image = models.ImageField(upload_to=file_upload_to)
image_type = models.CharField(max_length=50)



parent is a Foreign Key to the original image

I use the Image Model in a formset:

ImageFormSet = inlineformset_factory(parent_model=Product, model=Image,
form=ImageModelForm, min_num=1, max_num=4, can_delete=True)



Steps:

Set the Product Form with the inlineformset for Image
Show and submit the creation form
save the original image(s)
after the original image is saved, create multiple image by cropping 
the original image, using a task
Edit/Update Form, show as image one of the cropped image (instead of 
original) by modifying(filter by image_type) the Formset queryset

An here appear the issue:

The {{form.id}} value in case of update, is the pk(id) of the cropped 
image, instead of the original image:





and when the image is updated, is replacing the cropped image in database 
instead of the original image, and the 'cropped' tasks after and insertion 
in database is wrong.

I tried to replace the value(using a custom widget) instead of the cropped 
image with the pk(id) of the original(parent_id).

but if I do, this, on updating/replacing an older image, the new replacing 
image, is ignored; the form submit with no errors, but the replace image is 
not replaced; the other new images are ok.

So I think is a mechanism that compares the value in the the input with 
what was passed to the form, and if doesn't correspond is jut ignoring.

-- 
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/bb636da0-293e-4427-9da4-966fc652dcc4%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Issues with image.path being reported wrong causing failing of a Celery task

2018-01-17 Thread Paul
I did, is not celery related. 

The only thing, that maybe is influencing the path, is that the Image model 
is used in an inlineformset.



On Wednesday, January 17, 2018 at 6:37:40 PM UTC+2, Matemática A3K wrote:
>
>
> b
> On Wed, Jan 17, 2018 at 12:17 PM, Paul <sevenr...@gmail.com > 
> wrote:
>
>> I have the following model:
>>
>>
>> class Image(models.Model): image = models.ImageField(upload_to=
>> file_upload_to)
>>
>>
>> I have a dynamic file_upload function:
>>
>>
>> def file_upload_to(instance, filename): 
>>   base = '_'.join([str(instance.item.pk), instance.item.slug])
>>   return os.path.join('accounts', base, 'item', base_2, 'images', filename)
>>
>> and in a ModelForm:
>>
>>
>> class ImageModelForm(ModelForm) 
>>  def save(self, commit=True): 
>>   image_obj = super().save(commit=commit) 
>>   product_image__task.delay(image_obj.image.path, image_obj.image.name, 
>> image_obj.product_id) return image_obj
>>
>>
>>
>> I tried also to wait for transaction:
>>
>>
>> transaction.on_commit( lambda: 
>> product_image_crop_task.delay(image_obj.image.path, image_obj.image.name, 
>> image_obj.product_id))
>>
>>
>>
>> The file is saved properly in a path like:
>>
>>
>> media/account/12_blue/images/image_name.jpeg
>>
>>
>>
>> The problem is that image_obj.image.path is not reporting the correct 
>> path, but this path:
>>
>>
>> media/image_name.jpeg
>>
>>
>> I use the image path, further passing it as an argument to a task, but 
>> because I received the wrong path, it will fail.
>>
>>
>> How can I fix this, and receive the correct path ?  I tried also using 
>> time.sleep(), nothing works, the path/location returned is wrong, even if 
>> is saved to the correct one.
>>
>
> The first thing I would do is to comment out all the celery tasks to see 
> if those are messing with path property (you are not using a custom 
> storage, right?) Also, the upload_to function you posted does not 
> correspond to the path generated, try to post the latest code :)
>  
>
>>
>> -- 
>> 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/7d57595e-95b5-49f4-a29a-34f73e30620d%40googlegroups.com
>>  
>> <https://groups.google.com/d/msgid/django-users/7d57595e-95b5-49f4-a29a-34f73e30620d%40googlegroups.com?utm_medium=email_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/0ac7266a-b913-4135-8a34-12ae22c15ee5%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Issues with image.path being reported wrong causing failing of a Celery task

2018-01-17 Thread Paul
 

I have the following model:


class Image(models.Model): image = models.ImageField(upload_to=
file_upload_to)


I have a dynamic file_upload function:


def file_upload_to(instance, filename): 
  base = '_'.join([str(instance.item.pk), instance.item.slug])
  return os.path.join('accounts', base, 'item', base_2, 'images', filename)

and in a ModelForm:


class ImageModelForm(ModelForm) 
 def save(self, commit=True): 
  image_obj = super().save(commit=commit) 
  product_image__task.delay(image_obj.image.path, image_obj.image.name, 
image_obj.product_id) return image_obj



I tried also to wait for transaction:


transaction.on_commit( lambda: 
product_image_crop_task.delay(image_obj.image.path, image_obj.image.name, 
image_obj.product_id))



The file is saved properly in a path like:


media/account/12_blue/images/image_name.jpeg



The problem is that image_obj.image.path is not reporting the correct path, 
but this path:


media/image_name.jpeg


I use the image path, further passing it as an argument to a task, but 
because I received the wrong path, it will fail.


How can I fix this, and receive the correct path ?  I tried also using 
time.sleep(), nothing works, the path/location returned is wrong, even if 
is saved to the correct one.

-- 
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/7d57595e-95b5-49f4-a29a-34f73e30620d%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


ManytoMany Relation and Custom widget in Django

2017-11-17 Thread Paul
I have two models Category and Products.

- a Product can have multiple Categories 
- a Category can have multiple Products.
- Categories have a circular Foreign key, to itself.
- not all Categories have the same depth level

Example:

Category A
- Category A_1
- category A_2
- Category A_2_1
Category B
Category C
- Category C_1


class Product:
categories = models.ManyToManyField(Category)
name = models.CharField(max_length=255)

class Category:
categories = models.ForeignKey(self)
name = models.CharField(max_length=255)

As Form I use a ModelForm:

class ProductForm(ModelForm):



class Meta:
model = Product
fields = ['categories', 'name', 'short_description', 
'description']
widgets = {
'categories': MyWidget,
}

**What I want to achieve:**

I want to implement a conditional select (narow options):

1. Only top parent Categories(level 0 A,B,C) are available
2. The user select a parent Category.  If the parent has children a new 
Select box appear with his children(category level 1 A1,C1) 
3. The user select a level 1 Category (A1,C1). If the parent has children a 
new Select box appear with his children(level 2 A2)

- The process is repeated until no children are availavable(recursive), an 
user select the "smallest" category in the tree
- A new button is available for the user to add more categories and start 
the 1-3 process again
- I want to do the select,add new select using JavaScript
- On Form Submit I want to send only the last children categories


Options I thought:

1. Change the ManyToMany coresponding default Fields - looks like there are 
no good hooks and/or inheritance
2. Use a non-default custom Field instean of ManytoMany(like Charfield) - 
more complex on clean,saving Form
3. Change/Inherit the widget. My issues is how to send the data to the 
default Field on submit, and get/show it on edit 
 
I need some help as code and indication how to do this.


-- 
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/dc81ac05-b0b7-4653-9779-70998dc86370%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


ManytoMany Relation and Custom widget in Django

2017-11-13 Thread Paul

I have two models Categories and Products.

A Product can have multiple Categories, a Category can have multiple 
Products.

The Categories have a circular Foreign key, to itself.

class Product:
categories = models.ManyToManyField(Category)
name = models.CharField(max_length=255)

class Category:
categories = models.ManyToManyField(Category)
name = models.CharField(max_length=255)

Not all Categories have the same depth level. A Category can have no 
children and a Category can have multiple grandchildren.

*What I want to achieve:*

When a user add/create a Product, only a select-box containing the parents 
will appear. 

After the parent is selected, if the parent has children another select 
will appear with that parent children. Also the possibility to add more 
categories.

When a user what to edit a product the select boxes for what was already 
chosen should be available.

*From where I start:*

I know that to ManyToMany relation corresponds a ModelMultipleChoiceField 
Field.

To a ModelMultipleChoiceField corresponds a SelectMultiple widget.

I thought of creating an widget that inherits from SelectMultiple and 
change the templates manipulating the get_context_data on the Widget.

But my problem is that in context I don't have (know to find) the parent 
relation inside categories. 

What are my options ? 

-- 
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/7a0c5ab1-8297-41f4-befa-3d0063f100d2%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Django raising error - hostname doesnot match.

2017-11-10 Thread Rahul Paul
Thanks James for your suggestion. So according to you, I must use the 
domain name and not the IP address anymore in my request. Thanks again.

On Friday, November 10, 2017 at 11:09:59 PM UTC+5:30, James Schneider wrote:
>
>
>
> On Nov 10, 2017 3:45 AM, "Rahul Paul" <rahulp...@gmail.com > 
> wrote:
>
> Hi, 
>
> I am using requests package to send a post request to an API within my 
> application.
>
> I am using the request as : 
>
> *requests.post("https://xx.xxx.xxx.xxx/my-admin/api/api2 
> <https://xx.xxx.xxx.xxx/my-admin/api/api2>", data=data)*
>
> where "xx.xxx.xxx.xxx" is the IP of my server on which this API is hosted.
>
> When I am trying to call this API from my application, django is raising 
> an  exception as follows:
>
> *SSLError: hostname 'xx.xxx.xxx.xxx' doesn't match 'xxx.com 
> <http://xxx.com>'*
>
> But when I put the domain name in the request i.e. "xxx.com", it gives me 
> proper result. Also when I put verify=False along with the request, my 
> application gives me proper result even with IP addess in the request. 
> However the very same API is returning proper result with both --- IP 
> address and domain name.
>
>
> This is how SSL/TLS works. The certificate is based on the domain name in 
> the CN or SAN fields. It will never work with just an IP address and a 
> valid publicity signed certificate. If your CA is signing certificates with 
> IP's instead of or in addition to names, I would start a campaign to have 
> them shut down.
>
>
> My server has a CA signed certificate but the DNS have forward entry but 
> doesnot have a PTR entry. I have also verified with digicert.com and 
> found that when I am entering the domain name, it is giving proper IP 
> address but when I am giving IP address, it is not able to resolve the 
> domain name. 
>
> This API was functioning working correctly with IP address when we had 
> self signed certificate.
>
>
> No, it didn't. That would indicate that you imported the self-signed CA 
> certificate into your trusted CA store. It would also mean that the 
> certificate was generated using the IP as the value of the CN or SAN. No 
> SSL library does that without a lot of coaxing, if it's even possible 
> anymore. 
>
>
>
> Also I am using nginx-gunicorn to run my application.
>
> Please help me with understanding why this is happening and what are the 
> best possible solutions for this problem.
>
>
> There is no problem to solve, you are just experiencing the joys of SSL, 
> and there are many. ;-)
>
> Just make it a point to use the name.
>
> -James
>

-- 
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/47237f58-6ee1-4e8d-a4eb-5fdece004995%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Django raising error - hostname doesnot match.

2017-11-10 Thread Rahul Paul
In some place I wrote that "However the very same API is returning proper 
result with both --- IP address and domain name". I would like to correct 
hat this scenario is working when I am hitting the API from POSTMAN.

On Friday, November 10, 2017 at 5:15:20 PM UTC+5:30, Rahul Paul wrote:
>
> Hi, 
>
> I am using requests package to send a post request to an API within my 
> application.
>
> I am using the request as : 
>
> *requests.post("https://xx.xxx.xxx.xxx/my-admin/api/api2 
> <https://xx.xxx.xxx.xxx/my-admin/api/api2>", data=data)*
>
> where "xx.xxx.xxx.xxx" is the IP of my server on which this API is hosted.
>
> When I am trying to call this API from my application, django is raising 
> an  exception as follows:
>
> *SSLError: hostname 'xx.xxx.xxx.xxx' doesn't match 'xxx.com 
> <http://xxx.com>'*
>
> But when I put the domain name in the request i.e. "xxx.com", it gives me 
> proper result. Also when I put verify=False along with the request, my 
> application gives me proper result even with IP addess in the request. 
> However the very same API is returning proper result with both --- IP 
> address and domain name.
>
> My server has a CA signed certificate but the DNS have forward entry but 
> doesnot have a PTR entry. I have also verified with digicert.com and 
> found that when I am entering the domain name, it is giving proper IP 
> address but when I am giving IP address, it is not able to resolve the 
> domain name. 
>
> This API was functioning working correctly with IP address when we had 
> self signed certificate.
>
> Also I am using nginx-gunicorn to run my application.
>
> Please help me with understanding why this is happening and what are the 
> best possible solutions for this problem.
>
> Thanks in advance.
>

-- 
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/f83f9682-4e7d-4ce9-95aa-67e6d6d4aff3%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Django raising error - hostname doesnot match.

2017-11-10 Thread Rahul Paul
Hi, 

I am using requests package to send a post request to an API within my 
application.

I am using the request as : 

*requests.post("https://xx.xxx.xxx.xxx/my-admin/api/api2;, data=data)*

where "xx.xxx.xxx.xxx" is the IP of my server on which this API is hosted.

When I am trying to call this API from my application, django is raising 
an  exception as follows:

*SSLError: hostname 'xx.xxx.xxx.xxx' doesn't match 'xxx.com'*

But when I put the domain name in the request i.e. "xxx.com", it gives me 
proper result. Also when I put verify=False along with the request, my 
application gives me proper result even with IP addess in the request. 
However the very same API is returning proper result with both --- IP 
address and domain name.

My server has a CA signed certificate but the DNS have forward entry but 
doesnot have a PTR entry. I have also verified with digicert.com and found 
that when I am entering the domain name, it is giving proper IP address but 
when I am giving IP address, it is not able to resolve the domain name. 

This API was functioning working correctly with IP address when we had self 
signed certificate.

Also I am using nginx-gunicorn to run my application.

Please help me with understanding why this is happening and what are the 
best possible solutions for this problem.

Thanks in advance.

-- 
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/b733d5ed-a2e7-4dff-9a86-ea8062616fe4%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


What is the role of __deepcopy__ in Python class and Django widget

2017-11-04 Thread Paul
 

First, I know how copy and deepcopy from copy module work for a list.


I'm interested the role of __deepcopy special method inside a class.


I need to create custom widgets in Django and I try to understand the 
python code behind.


class Widget(metaclass=MediaDefiningClass):

needs_multipart_form = False  # Determines does this widget need multipart 
form
is_localized = False
is_required = False
supports_microseconds = True  # for data and time values

def __init__(self, attrs=None):
if attrs is not None:
self.attrs = attrs.copy()
else:
self.attrs = {}

def __deepcopy__(self, memo):
obj = copy.copy(self)
obj.attrs = self.attrs.copy()
memo[id(self)] = obj
return obj

What is happening with *__deepcopy__* when I make an instance of Widget, or 
and instance of a subclass of Widget ? Looks like is making a shallow copy 
of attributes and the object itself , but what is the purpose ?

-- 
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/7d313c90-4407-4f9f-9518-de5327d14178%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


ManytoMany field in Django admin not appearing

2017-11-03 Thread Paul
 

I have a Product model, an Image Model and a Category Model.

A Product can have multiple Images(Foreign Key) and a Product can be in 
multiple Categories a Category can contain multiple Products.

A Category can have multiple subcategories(key to itself).


class Category(MetaData): 
 parent = models.ForeignKey('self', blank=True, null=True, verbose_name='parent 
category', on_delete=models.CASCADE) 

class ProductMetaData): 
  categories = models.ManyToManyField(Category) 

class ProductImage(models.Model):  
  product = models.ForeignKey(Product, related_name='image', on_delete=
models.CASCADE)



In Product Django Admin: 

class ProductDocumentInline(admin.TabularInline): 
 model = ProductDocument class ProductAdmin(MetaData):
 inlines = [ProductImageInline]
 fieldsets = (
 ('Product Data', {
 'fields': ('name', 'short_description', 'description')
 }),
 ('SEO', {
 'classes': ('collapse',),
 'fields': ('meta_title', 'meta_description', 'slug', 'canonical')
 }),
 ('MetaData', {
 'classes': ('collapse',),
 'fields': (('created_at', 'created_by'), ('updated_at', 'updated_by'))
 }),
 )
 readonly_fields = ('created_at', 'updated_at', 'created_by', 'updated_by')
 list_display = ('name', 'updated_at')
 ordering = ('-updated_at',)
 search_fields = ('name',)


admin.site.register(Product, ProductAdmin)
admin.site.register(ProductImage)



Issues:

   1. 
   
   If I don't customize fieldsets (grouped, ordered) the Categories appear 
   like default in the middle of the form. If there are customized as in my 
   example they don't appear.
   2. 
   
   If they don't appear Products without Categories can be created and I 
   don't want that. I want a product to have at least one category.
   3. 
   
   Now the inline Images appear below all Product fields. 
   
I want the Categories to appear first, then normal fields for 
Product(grouped,ordered), Images inline and at the end the SEO and metadata 
fields. How can this be done ?

-- 
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/37bf83ae-cdca-4c73-8ace-747386513e53%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Possible Bug Regarding model choices and form hidden input?

2017-10-28 Thread Paul Kenjora
*I use: *

Django version 1.7.0 - I know I know :)

Python 2.7.13

- Paul

On Sat, Oct 28, 2017 at 6:01 AM, Etienne Robillard <tkad...@yandex.com>
wrote:

> Which Python and Django versions do you use?
>
> Etienne
>
> Le 2017-10-27 à 23:27, Paul Kenjora a écrit :
>
> Hi,
>
>   When setting HiddenInput on a form widget for an integer model field
> with choices, in tests I get 'X is not a valid choice' errors.  I'm
> guessing it's the hidden input returning a STRING and the model expecting
> an INT.
>
>   I have a model that has
>
>
> *class Banner(models.Model): *
>
> *  banner_x = models.PositiveIntegerField(blank=False, default=0,
> choices=enumerate(BANNER_XS))*
>
>
> And a form that has
>
> *class BannerForm(forms.ModelForm):*
>
> *  class Meta:*
>
> *model = Banner*
>
> *fields = ['banner_x']*
>
> *  def __init__(self, *args, **kwargs):*
>
> *kwargs['prefix'] = 'banner'*
>
> *super(BannerForm, self).__init__(*args, **kwargs)*
>
> *self.fields['banner_x'].widget = forms.HiddenInput()*
>
>
> In my unit tests I always get the error:
>
> *resp = self.client.post(**'/banner/, {*
>
> *  'banner-banner_x':0,*
>
>
> *}, follow=True) *
>
> *banner_xSelect a
> valid choice. 0 is not one of the available choices.*
>
>
> Anyone else seeing this?  Works fine via browser, just unit tests are not
> coming back right.
>
> --
> - Paul Kenjora
> - 602-214-7285 <(602)%20214-7285>
> --
> 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/CAEH8JE3HuYObgFkpmVNnz39Gt7NMj
> JUX9jXsr9tenGYhwgG_GA%40mail.gmail.com
> <https://groups.google.com/d/msgid/django-users/CAEH8JE3HuYObgFkpmVNnz39Gt7NMjJUX9jXsr9tenGYhwgG_GA%40mail.gmail.com?utm_medium=email_source=footer>
> .
> For more options, visit https://groups.google.com/d/optout.
>
>
> --
> Etienne Robillardtkadm30@yandex.comhttp://www.isotopesoftware.ca/
>
>


-- 
- Paul Kenjora
- 602-214-7285

-- 
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/CAEH8JE3W7kL8g64ZAWcOEJg1kDO%2Bv9X6_%2BXHMeTSEjt8vxLsBw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Possible Bug Regarding model choices and form hidden input?

2017-10-27 Thread Paul Kenjora
Hi,

  When setting HiddenInput on a form widget for an integer model field with
choices, in tests I get 'X is not a valid choice' errors.  I'm guessing
it's the hidden input returning a STRING and the model expecting an INT.

  I have a model that has


*class Banner(models.Model):*

*  banner_x = models.PositiveIntegerField(blank=False, default=0,
choices=enumerate(BANNER_XS))*


And a form that has

*class BannerForm(forms.ModelForm):*

*  class Meta:*

*model = Banner*

*fields = ['banner_x']*

*  def __init__(self, *args, **kwargs):*

*kwargs['prefix'] = 'banner'*

*super(BannerForm, self).__init__(*args, **kwargs)*

*self.fields['banner_x'].widget = forms.HiddenInput()*


In my unit tests I always get the error:

*resp = self.client.post(**'/banner/, {*

*  'banner-banner_x':0,*


*}, follow=True)*

*banner_xSelect a valid
choice. 0 is not one of the available choices.*


Anyone else seeing this?  Works fine via browser, just unit tests are not
coming back right.

-- 
- Paul Kenjora
- 602-214-7285

-- 
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/CAEH8JE3HuYObgFkpmVNnz39Gt7NMjJUX9jXsr9tenGYhwgG_GA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


How Django inlineformsets works internally

2017-10-10 Thread Paul
 I have a form with two inline formsets.
. 

At the HTML level Django use the hidden fields for the formset management, 
and use the prefix to know which fields are related to a formset.

Also it has ids in the html id, to group like in a virtual form the fields.


 
 




On retrieve by default I get the path to the file in a paragraph and the 
inputs (html elements) are empty.



 Currently: 
Test 
Insieme/documents/sdsasa7

Change:





On Browse(upload a different file) Django knows to update the same record 
in the database. Similar for click on checkbox.


*How Django make the correlation between the paragraph that show the path, 
the html id of the element and what is in the database?*


I want to change the UI (make it dynamic with JavaScript, use button 
instead of checkbox) and I want to understand how the mechanism is working.

-- 
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/d5e2106e-ee4d-4272-8b37-d22ace33ed63%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Django InlineFormset : Customize inputs and widget

2017-10-04 Thread Paul


I’m using inlineformsets for an Image Model in combination with a Product 
Model.


For the Image Model (using javascript):


1) a remove/delete button will be available to remove an image; the image 
can be remove not only on edit, but also on creation(the use upload the 
image, but before saving doesn’t like the image and removes it) 2) An add 
button, when the user clicks a new input and corresponding fields are added


By default the inlineformset code is like this:


Document: File 
type: Delete:


Using inputs I can do it with javascript, but things get a little more 
complicated for what I want to do:


The user should click on an image button a modal window will appear with 
the option to crop. 

Now the Upload button is in the modal window. The user is cropping, I 
select and save the coordinates with javascript, also show a cropped image 
(simulated using css).


How do I transfer all this mechanism to Django inputs so formsets can 
understand what I want to do ?








-- 
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/69728ba1-1462-4f41-8064-a46e05287ea8%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Implementation Advice: Categories and Product Specifications

2017-10-02 Thread Paul
 

I have Product and Categories. A product can be in multiple categories and 
off course a Category have multiple products.


The Categories can have Subcategories’ which can have Subcategories. I used 
a Category Model with a circular Foreign Key.


Each Product can have specifications/attributes based in which Categories 
is. 


So the specifications are of the products but depends on the Categories.


I can’t add the specifications as Products attributes because they depend 
on categories, and the user can change categories.


I can’t add them as attributes per Category because the value are/can be 
different for each product.


Also an attribute/specification can appear in multiple Categories.


I want also to search for a Product filtering by attributes.


I think I need a separate Attribute Model that is linked (foreign key) to 
both Product and Category.


Also a way of “protection” in case a Product change categories, a Product 
and/or a Category is deleted.


What is the optimal approach as flexibility and performance ? 

-- 
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/adf6c608-45fd-4c5f-a8c1-7a11b67fc3b2%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Django: Form validation strange behaviour

2017-09-29 Thread Paul
 

I want to do file validation(size,type) on a field on inlineformset. 


class ProductDocumentModelForm(ModelForm): 

  class Meta: model = ProductDocument 
   fields = ['document'] 

  def clean_document(self): 
   file = self.cleaned_data['document'] 
   validate_file(file, 'document')



Because I want to use the same validation in multiple application I created 
a separate function.


def validate_file(file, for_model, max_size=5000): 
 if for_model == 'document': 
  max_size = FILE_MAX_DOC_SIZE 
 
 if file.size > max_size: 
  raise ValidationError('Please keep file size under {}. Current file size is 
{}' .format(filesizeformat(FILE_MAX_DOC_SIZE), filesizeformat(file.size)))



The file size validation works as intended but introduce a strange behavior.


If this validation is in place and is passed the "This field cannot be 
blank." default validation is triggered even if the fields are not empty.


Without the file size validation in place there are no issue even if the 
fields are empty.


I don't understand what is the cause. 

-- 
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/a470e4e3-3cb9-489e-930c-8adc6b6210c3%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Django - Best option to check file types, even fake or without extensions

2017-09-22 Thread Paul
 

I'm trying to validate mime types of files uploaded with a predefined list 
of validate mime types. 


I need to do the check the file in the buffer before save, even if they are 
faked or no extensions.



1. python own  mimetypes package seems to "guess" only base on extension


2. magic-python looks ok, but has OS dependencies because is using UNIX 
libmagic.

 I had a lot of trouble with it on Windows 64 bit, and even after I fixed 
the dependencies error other issue appears and it couldn't identify files.

 This also is a issue because is hard to install OS related filed on a 
predefined hosting.


3. I found filetype package but it only checks "magic numbers" for a 
limited file types, and docx and other identifies them as zip file(wich are 
archive as technology),

 but I need to identify them as what they really are.


What other non OS dependent solutions that can check if the file is faked 
or with no extension exist ? (pdf,doc,docs,csv,xls,xlsx, ods,odt,odm)










-- 
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/b5280e1b-ef5c-4749-a243-c75b3275c897%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Django - Image crop using a widget as a field in the form

2017-08-23 Thread Paul


I have a Product Model and Image Model with a Foreign key to the product 
model. 


So in a form for Product creation I will have/need multiple Image File 
Upload inputs. 


I want to replace the default Image file-upload form field with a Image 
(like a plus sign, like add a new image, using a widget). 


When the user click on a add a new image a pop-up will apear with a 
javascript crop. I need to get the data(coordinates) from the javascript 
crop back to Django, use Pillow to crop and fill the Image Model field.


What is the best approach for this mechanism for the form field(will not be 
a real upload) ? , maybe a link to a tutorial 


(I know there are some Django package that do something like that but are 
really what I want regarding crop control)









-- 
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/dca42a40-1bb2-4912-a91c-4e8225a34ed4%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: django.db.utils.OperationalError: server closed the connection unexpectedly

2017-06-01 Thread Bobby Paul
Thank you Antonis,
Yeah, We have installed postgresql-8.4.20-7.el6.x86_64

Now we are checking the permission. Will touch you once it done.

Thanks,

Bobby Paul
On Wednesday, May 31, 2017 at 5:14:29 PM UTC+5:30, Bobby Paul wrote:
>
> Dear All,
>
> I am getting this error message while trying to install psql database.
>
>  File "setup.py", line 18, in 
> execute_from_command_line(['manage.py','migrate'])
>   File 
> "/usr/local/bin/lib/python2.7/site-packages/django/core/management/__init__.py",
>  
> line 354, in execute_from_command_line
> utility.execute()
>   File 
> "/usr/local/bin/lib/python2.7/site-packages/django/core/management/__init__.py",
>  
> line 346, in execute
> self.fetch_command(subcommand).run_from_argv(self.argv)
>   File 
> "/usr/local/bin/lib/python2.7/site-packages/django/core/management/base.py", 
> line 394, in run_from_argv
> self.execute(*args, **cmd_options)
>   File 
> "/usr/local/bin/lib/python2.7/site-packages/django/core/management/base.py", 
> line 445, in execute
> output = self.handle(*args, **options)
>   File 
> "/usr/local/bin/lib/python2.7/site-packages/django/core/management/commands/migrate.py",
>  
> line 93, in handle
> executor = MigrationExecutor(connection, 
> self.migration_progress_callback)
>   File 
> "/usr/local/bin/lib/python2.7/site-packages/django/db/migrations/executor.py",
>  
> line 19, in __init__
> self.loader = MigrationLoader(self.connection)
>   File 
> "/usr/local/bin/lib/python2.7/site-packages/django/db/migrations/loader.py", 
> line 47, in __init__
> self.build_graph()
>   File 
> "/usr/local/bin/lib/python2.7/site-packages/django/db/migrations/loader.py", 
> line 191, in build_graph
> self.applied_migrations = recorder.applied_migrations()
>   File 
> "/usr/local/bin/lib/python2.7/site-packages/django/db/migrations/recorder.py",
>  
> line 59, in applied_migrations
> self.ensure_schema()
>   File 
> "/usr/local/bin/lib/python2.7/site-packages/django/db/migrations/recorder.py",
>  
> line 49, in ensure_schema
> if self.Migration._meta.db_table in 
> self.connection.introspection.table_names(self.connection.cursor()):
>   File 
> "/usr/local/bin/lib/python2.7/site-packages/django/db/backends/base/base.py", 
> line 162, in cursor
> cursor = self.make_debug_cursor(self._cursor())
>   File 
> "/usr/local/bin/lib/python2.7/site-packages/django/db/backends/base/base.py", 
> line 135, in _cursor
> self.ensure_connection()
>   File 
> "/usr/local/bin/lib/python2.7/site-packages/django/db/backends/base/base.py", 
> line 130, in ensure_connection
> self.connect()
>   File "/usr/local/bin/lib/python2.7/site-packages/django/db/utils.py", 
> line 98, in __exit__
> six.reraise(dj_exc_type, dj_exc_value, traceback)
>   File 
> "/usr/local/bin/lib/python2.7/site-packages/django/db/backends/base/base.py", 
> line 130, in ensure_connection
> self.connect()
>   File 
> "/usr/local/bin/lib/python2.7/site-packages/django/db/backends/base/base.py", 
> line 119, in connect
> self.connection = self.get_new_connection(conn_params)
>   File 
> "/usr/local/bin/lib/python2.7/site-packages/django/db/backends/postgresql_psycopg2/base.py",
>  
> line 176, in get_new_connection
> connection = Database.connect(**conn_params)
>   File "/usr/local/bin/lib/python2.7/site-packages/psycopg2/__init__.py", 
> line 130, in connect
> conn = _connect(dsn, connection_factory=connection_factory, **kwasync)
> django.db.utils.OperationalError: server closed the connection unexpectedly
> This probably means the server terminated abnormally
> before or while processing the request.
> ==
> DATABASES_DEFAULT = {
>
> 'ENGINE': 'django.db.backends.postgresql_psycopg2',
> 'NAME': 'litdb',
> 'USER': 'root',
> 'PASSWORD': '',
> 'HOST': 'localhost',
> 'PORT': '80',
> }
>
> How to sort this issue?
>
> Kind Regards
> Bobby Paul
>

-- 
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/92514ce1-503c-4904-8da7-857dd70e10cc%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Restricting the user from closing the browser tab so that the server side APIs are called.

2017-05-31 Thread Rahul Paul
Hi,

We are working on a django project in which we are developing a two way 
audio visual solution for the users. Now we have certain set of APIs that 
need to be called from JavaScript through ajax request when user ends the 
call through our end-call button. Some of these ajax calls are sequential 
i.e. based on result of one ajax call another ajax call is made.

Now our problem is if the user close the tab or browser using the cross 
button of tab or browser, then these APIs are not called and many of our 
functionalities does not work. Hence to solve this we were looking into the 
following options : 

1. Restricting the user from closing the tab or browser until the user 
clicks on end-call button and all functionalities related to ending the 
call is done.
2. Calling the APIs before the browser or tab close when user tries to 
close the browser or tab.
3. Opening our template as a modal so that we can modify the closing of 
modal to satisfy our use case.

First option is not possible since it poses security risks w.r.t. browser. 
Currently our web page is opening as new tab. We have tried opening the 
page as new window and hiding the menu bar, minimize/maximize and cross 
button, but we could not hide the cross button. 

We tried the second option using window.onbeforeunload and window.onunload 
feature of JavaScript window object, but we could not call the APIs.

We are now thinking of the third option, but here we are stuck as we are 
not sure if the template can be directly rendered as a modal from django 
views. 

Also our web page will have the following major components : 

* video tag, where 2-way A/V will play.
* iframe where we have another feature.
* chat section where communication happens through django channels.
* File upload and download feature.
* Many functionalities are based on API call hence many ajax request.

In short our web page will be heavy and will have a lot of javascript files 
to be loaded. So will we get the same efficiency with modal as we get with 
proper web page? What will be the limitation and if possible how we can 
render our template as modal?

Our main intention have the same flow when the user clicks the end-call 
button or close the tab or browser i.e. all the functionalities that are 
happening when end-call button is clicked, must also happen when the user 
close the tab or browser.

Please help me with resolving this issue. You can also provide options 
other then what we have considered. All suggestions are welcome.

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 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/c0aff7ca-137a-4b28-80ab-a246f35dd4df%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: django.db.utils.OperationalError: server closed the connection unexpectedly

2017-05-31 Thread Bobby Paul
Dear Antonis,

Thank you very much for your quick response.
Sorry, I am newer in this field. I was trying to install LitDB 
(http://www.ikmb.uni-kiel.de/litdb)
I changed the settings as what your suggestion, but not happened.

with port number 5432, it showing
 Is the server running on host "localhost" (::1) and accepting
TCP/IP connections on port 5432?
could not connect to server: Connection refused
Is the server running on host "localhost" (127.0.0.1) and accepting
TCP/IP connections on port 5432?

Is there any other settings i need to change?
Thanks and Regards
Bobby Paul


On Wednesday, May 31, 2017 at 5:14:29 PM UTC+5:30, Bobby Paul wrote:
>
> Dear All,
>
> I am getting this error message while trying to install psql database.
>
>  File "setup.py", line 18, in 
> execute_from_command_line(['manage.py','migrate'])
>   File 
> "/usr/local/bin/lib/python2.7/site-packages/django/core/management/__init__.py",
>  
> line 354, in execute_from_command_line
> utility.execute()
>   File 
> "/usr/local/bin/lib/python2.7/site-packages/django/core/management/__init__.py",
>  
> line 346, in execute
> self.fetch_command(subcommand).run_from_argv(self.argv)
>   File 
> "/usr/local/bin/lib/python2.7/site-packages/django/core/management/base.py", 
> line 394, in run_from_argv
> self.execute(*args, **cmd_options)
>   File 
> "/usr/local/bin/lib/python2.7/site-packages/django/core/management/base.py", 
> line 445, in execute
> output = self.handle(*args, **options)
>   File 
> "/usr/local/bin/lib/python2.7/site-packages/django/core/management/commands/migrate.py",
>  
> line 93, in handle
> executor = MigrationExecutor(connection, 
> self.migration_progress_callback)
>   File 
> "/usr/local/bin/lib/python2.7/site-packages/django/db/migrations/executor.py",
>  
> line 19, in __init__
> self.loader = MigrationLoader(self.connection)
>   File 
> "/usr/local/bin/lib/python2.7/site-packages/django/db/migrations/loader.py", 
> line 47, in __init__
> self.build_graph()
>   File 
> "/usr/local/bin/lib/python2.7/site-packages/django/db/migrations/loader.py", 
> line 191, in build_graph
> self.applied_migrations = recorder.applied_migrations()
>   File 
> "/usr/local/bin/lib/python2.7/site-packages/django/db/migrations/recorder.py",
>  
> line 59, in applied_migrations
> self.ensure_schema()
>   File 
> "/usr/local/bin/lib/python2.7/site-packages/django/db/migrations/recorder.py",
>  
> line 49, in ensure_schema
> if self.Migration._meta.db_table in 
> self.connection.introspection.table_names(self.connection.cursor()):
>   File 
> "/usr/local/bin/lib/python2.7/site-packages/django/db/backends/base/base.py", 
> line 162, in cursor
> cursor = self.make_debug_cursor(self._cursor())
>   File 
> "/usr/local/bin/lib/python2.7/site-packages/django/db/backends/base/base.py", 
> line 135, in _cursor
> self.ensure_connection()
>   File 
> "/usr/local/bin/lib/python2.7/site-packages/django/db/backends/base/base.py", 
> line 130, in ensure_connection
> self.connect()
>   File "/usr/local/bin/lib/python2.7/site-packages/django/db/utils.py", 
> line 98, in __exit__
> six.reraise(dj_exc_type, dj_exc_value, traceback)
>   File 
> "/usr/local/bin/lib/python2.7/site-packages/django/db/backends/base/base.py", 
> line 130, in ensure_connection
> self.connect()
>   File 
> "/usr/local/bin/lib/python2.7/site-packages/django/db/backends/base/base.py", 
> line 119, in connect
> self.connection = self.get_new_connection(conn_params)
>   File 
> "/usr/local/bin/lib/python2.7/site-packages/django/db/backends/postgresql_psycopg2/base.py",
>  
> line 176, in get_new_connection
> connection = Database.connect(**conn_params)
>   File "/usr/local/bin/lib/python2.7/site-packages/psycopg2/__init__.py", 
> line 130, in connect
> conn = _connect(dsn, connection_factory=connection_factory, **kwasync)
> django.db.utils.OperationalError: server closed the connection unexpectedly
> This probably means the server terminated abnormally
> before or while processing the request.
> ==
> DATABASES_DEFAULT = {
>
> 'ENGINE': 'django.db.backends.postgresql_psycopg2',
> 'NAME': 'litdb',
> 'USER': 'root',
> 'PASSWORD': '',
> 'HOST': 'localhost',
> 'PORT': '80',
> }
>
> How to sort this issue?
>
> Kind Regards
> Bobby Paul
>

-- 
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/c367c3b4-502b-49ec-94e3-10a0433ccb99%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


django.db.utils.OperationalError: server closed the connection unexpectedly

2017-05-31 Thread Bobby Paul
Dear All,

I am getting this error message while trying to install psql database.

 File "setup.py", line 18, in 
execute_from_command_line(['manage.py','migrate'])
  File 
"/usr/local/bin/lib/python2.7/site-packages/django/core/management/__init__.py",
 
line 354, in execute_from_command_line
utility.execute()
  File 
"/usr/local/bin/lib/python2.7/site-packages/django/core/management/__init__.py",
 
line 346, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
  File 
"/usr/local/bin/lib/python2.7/site-packages/django/core/management/base.py", 
line 394, in run_from_argv
self.execute(*args, **cmd_options)
  File 
"/usr/local/bin/lib/python2.7/site-packages/django/core/management/base.py", 
line 445, in execute
output = self.handle(*args, **options)
  File 
"/usr/local/bin/lib/python2.7/site-packages/django/core/management/commands/migrate.py",
 
line 93, in handle
executor = MigrationExecutor(connection, 
self.migration_progress_callback)
  File 
"/usr/local/bin/lib/python2.7/site-packages/django/db/migrations/executor.py", 
line 19, in __init__
self.loader = MigrationLoader(self.connection)
  File 
"/usr/local/bin/lib/python2.7/site-packages/django/db/migrations/loader.py", 
line 47, in __init__
self.build_graph()
  File 
"/usr/local/bin/lib/python2.7/site-packages/django/db/migrations/loader.py", 
line 191, in build_graph
self.applied_migrations = recorder.applied_migrations()
  File 
"/usr/local/bin/lib/python2.7/site-packages/django/db/migrations/recorder.py", 
line 59, in applied_migrations
self.ensure_schema()
  File 
"/usr/local/bin/lib/python2.7/site-packages/django/db/migrations/recorder.py", 
line 49, in ensure_schema
if self.Migration._meta.db_table in 
self.connection.introspection.table_names(self.connection.cursor()):
  File 
"/usr/local/bin/lib/python2.7/site-packages/django/db/backends/base/base.py", 
line 162, in cursor
cursor = self.make_debug_cursor(self._cursor())
  File 
"/usr/local/bin/lib/python2.7/site-packages/django/db/backends/base/base.py", 
line 135, in _cursor
self.ensure_connection()
  File 
"/usr/local/bin/lib/python2.7/site-packages/django/db/backends/base/base.py", 
line 130, in ensure_connection
self.connect()
  File "/usr/local/bin/lib/python2.7/site-packages/django/db/utils.py", 
line 98, in __exit__
six.reraise(dj_exc_type, dj_exc_value, traceback)
  File 
"/usr/local/bin/lib/python2.7/site-packages/django/db/backends/base/base.py", 
line 130, in ensure_connection
self.connect()
  File 
"/usr/local/bin/lib/python2.7/site-packages/django/db/backends/base/base.py", 
line 119, in connect
self.connection = self.get_new_connection(conn_params)
  File 
"/usr/local/bin/lib/python2.7/site-packages/django/db/backends/postgresql_psycopg2/base.py",
 
line 176, in get_new_connection
connection = Database.connect(**conn_params)
  File "/usr/local/bin/lib/python2.7/site-packages/psycopg2/__init__.py", 
line 130, in connect
conn = _connect(dsn, connection_factory=connection_factory, **kwasync)
django.db.utils.OperationalError: server closed the connection unexpectedly
This probably means the server terminated abnormally
before or while processing the request.
==
DATABASES_DEFAULT = {

'ENGINE': 'django.db.backends.postgresql_psycopg2',
'NAME': 'litdb',
'USER': 'root',
'PASSWORD': '',
'HOST': 'localhost',
'PORT': '80',
}

How to sort this issue?

Kind Regards
Bobby Paul

-- 
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/b07acc86-a2a9-4fe7-9004-0f7a90fe4100%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Some reversible migrations cannot be reversed in practice?

2017-04-19 Thread paul
I've just hit a tricky migration case, and I'd like to check I'm not 
missing something. The summary is that merge migrations make it possible to 
add migrations which cannot be unapplied, even if they are the latest 
migration to be run.

With the migration graph:

M1
|
+--+
|  |
M2a   M2b
|  |
+--+
|
M3(merge)

Now, as far as a can tell, if I want to revert M2b, I have to run 
`manage.py migrate app M1`. If M2a is not reversible, then it's impossible 
to un-apply M2b, even though the dependency graph would allow it. Or to 
consider another pathological case, imagine a long-running series of 
deployed migrations (M2a, M3a, M4a, ...) instead of an immediate merge 
commit; the M2b migration could be impossible to revert without reverting 
many other migrations in the other branch, which could delete user data if 
run in production.

It seems there's a missing command, `manage.py revertmigration M2b`, which 
would walk the dependency graph backwards to figure out which later 
migrations needed to be unapplied (in this case M2b and M3). Absent this 
command, it seems that merge migrations aren't safe to use, and should be 
avoided.

Am I missing something here? Appreciate any insights or workarounds anyone 
has on this subject.

-- 
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/7093f0ed-f927-4010-988c-de93f9bd9a3a%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


  1   2   3   4   5   6   >