Django bugfix release: 4.1.5

2023-01-01 Thread Mariusz Felisiak

Details are available on the Django project weblog:

https://www.djangoproject.com/weblog/2023/jan/02/bugfix-release/

--
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/8ac3a04d-5545-b92a-82c4-7abd647bde6b%40gmail.com.


Re: Apache and mod_wsgi with django

2023-01-01 Thread Mike Dewhirst

On 2/01/2023 1:44 pm, pankaj palmate wrote:


Hi i am using Apache with mod_wsgi.i want to serve 5000 users at a 
time.how many processes and threads should I use in order to serve 
5000 connections concurrently...in wsgi daemon process ?


I can't answer the question because it is above my pay-grade. However, I 
have recently (successfully) adjusted my own mpm-event settings based on 
advice from the Apache support list ... us...@httpd.apache.org


They are very friendly but will probably ask you for more information 
including which mpm module you are using. If you enable apache-status 
you will be able to gather most of that info before asking for help.


Cheers

Mike


--
You received this message because you are subscribed to the Google 
Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send 
an email to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAPyMU1LG_JWo_4st5mjZ5Ps%2BMdJoBnHQHCya1CK-Qm7AZjGYnw%40mail.gmail.com 
.



--
Signed email is an absolute defence against phishing. This email has
been signed with my private key. If you import my public key you can
automatically decrypt my signature and be sure it came from me. Just
ask and I'll send it to you. Your email software can handle signing.

--
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/325ed00e-7fc6-c65c-7c7f-ca9c6b6b328b%40dewhirst.com.au.


OpenPGP_signature
Description: OpenPGP digital signature


Apache and mod_wsgi with django

2023-01-01 Thread pankaj palmate
Hi i am using Apache with mod_wsgi.i want to serve 5000 users at a time.how
many processes and threads should I use in order to serve 5000 connections
concurrently...in wsgi daemon process ?

-- 
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/CAPyMU1LG_JWo_4st5mjZ5Ps%2BMdJoBnHQHCya1CK-Qm7AZjGYnw%40mail.gmail.com.


How to access the value of a field that failed validation

2023-01-01 Thread Noel Duffy
I'm new to Django, though not to programming. I'm using Django 4.1.4 on 
AlmaLinux 9.


My question is this. Is it possible to access a ModelForm field's value 
if that form field failed validation?


I'm writing a small ticketing system for a helpdesk to handle spam 
reports. Users submit spam messages which the system will then process. 
I'm using a ModelForm, and the database schema specifies that the spam 
message is unique. That is, each spam message can be reported only once, 
so there's just one ticket but possibly many different actions taken 
depending on what's in the spam.


This is the model:

class AbuseReport(models.Model):
report_date = models.DateTimeField(auto_now_add=True)
report_subject = models.CharField(max_length=255)
report_msgid = models.CharField(max_length=255, unique = True)
report_spam_text = models.TextField(unique = True)
def __str__(self):
return report_subject

class Meta:
ordering = ['-report_date']

Now, the problem is that a spam message will fail form validation in the 
form.is_valid call if the spam message fails the "unique" constraint. 
Why is this a problem? Because I want to get my hands on the spam 
message if it's already in the DB so that instead of just re-showing my 
form with an error message saying the spam already exists, I want to 
redirect to the existing ticket. But so far I've not been able to figure 
out how to do this, and when I dump the contents of the form in 
debugging, the spam message just isn't there.


I should add that the ModelForm only creates a field for the 
report_spam_text field. I.e,


class AbuseReportForm(ModelForm):
def __init__(self, *args, **kwargs):
super(ModelForm, self).__init__(*args, **kwargs)

def clean(self):
[...]

class Meta:
model = AbuseReport
fields = ['report_spam_text']
widgets = {'report_spam_text':
   Textarea(attrs={
   'rows': 20,
   'class':'textarea',
   'placeholder':'Paste spam with full headers here..'
   }),}


This is what my view looks like (stripped down for simplicity):

def spamsubmit(request):
# if this is a POST request we need to process the form data
if request.method == 'POST':
# create a form instance and populate it with data from the 
request:

form = AbuseReportForm(request.POST)
# check whether it's valid:
if form.is_valid():
# process the data in form.cleaned_data as required
[.]
else:
## show the form again with errors displayed
## if spam already exists this is what gets run.
return render(request, 'abuse/spam_form.html',{'form':form})

As I understand it, fields aren't bound to data until is_valid is 
called, and if is_valid fails then only fields that didn't fail validity 
go into cleaned_data. But it seems everything else is lost. But I'm not 
100% sure about this and this is why I'm asking.




--
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/tot7hm%2412qg%241%40ciao.gmane.io.


[no subject]

2023-01-01 Thread ALBERT ASHABA AHEEBWA
Hello Everyone,

I have been trying to host my Django app on linode for the last 3 days. I
have tried every tutorial I could find on both google and YouTube. But
nothing seems to work .

The furthest I have gone is 502 BAD GATEWAY nginx...

Can someone point me to a straight forward solution.

Thank you.



Best Regards,

Albert Ashaba Aheebwa
+256 781 435857

-- 
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/CAAQecPcVnMvG3RCEqwn_ndsAA6VVWp-vxxmm6cMyMnYWLLgEFQ%40mail.gmail.com.