Re: Sending Email from form

2019-06-28 Thread Emmanuel klutse
Thank you Dube!!! Will check it out and update shortly. 

Sent from my iPhone

> On 29 Jun 2019, at 2:27 AM, Sithembewena L. Dube  wrote:
> 
> I just finished a project where I did the same thing you require.
> 
> I used the Mailgun API.
> 
> The relevant documentation can be found here:
> https://documentation.mailgun.com/en/latest/user_manual.html#sending-via-api
> 
> Kind regards,
> Lloyd
> 
> 
> Sent with Shift
> 
>> On Fri, Jun 28, 2019 at 8:22 PM Emmanuel klutse  wrote:
>> Hello Team. 
>> I’m new to programming and I’ve been studying Django for 6 months now. I 
>> just started my first project and i need help with handling sending emails 
>> from a user form.
>> I am using send_mail function to allow anyone who wants to contact me 
>> through my contact page. Its is working fine but I need a way for Django to 
>> allow me get an email from my application using the email address provided 
>> by the user in fill the form instead of the one I provided in settings.py.
>> Please help…. I have been on this for the past one week. 
>> 
>> I’m also available to assisting anyone who needs someone with my level on a 
>> project for free. 
>> 
>> Thank you
>> Emmanuel klutse
>> +233202729851
>> -- 
>> 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/60A5D9BF-5096-4824-90D2-7149E1ACC82E%40gmail.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/CAH-SnCDv4dz8%2BFyr3%2By-0GUxX41Nbnv%2BjsXrgnquOGVHp83vpw%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/693AE2FF-CD94-416C-8527-7497F0C7A853%40gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Sending Email from form

2019-06-28 Thread Sithembewena L. Dube
I just finished a project where I did the same thing you require.

I used the Mailgun API.

The relevant documentation can be found here:
https://documentation.mailgun.com/en/latest/user_manual.html#sending-via-api

Kind regards,
Lloyd


*Sent with Shift
*

On Fri, Jun 28, 2019 at 8:22 PM Emmanuel klutse  wrote:

> Hello Team.
> I’m new to programming and I’ve been studying Django for 6 months now. I
> just started my first project and i need help with handling sending emails
> from a user form.
> I am using send_mail function to allow anyone who wants to contact me
> through my contact page. Its is working fine but I need a way for Django to
> allow me get an email from my application using the email address provided
> by the user in fill the form instead of the one I provided in settings.py.
> Please help…. I have been on this for the past one week.
>
> *I’m also available to assisting anyone who needs someone with my level on
> a project for free. *
>
> *Thank you*
> *Emmanuel klutse*
> *+233202729851*
>
> --
> 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/60A5D9BF-5096-4824-90D2-7149E1ACC82E%40gmail.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/CAH-SnCDv4dz8%2BFyr3%2By-0GUxX41Nbnv%2BjsXrgnquOGVHp83vpw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Sending Email from form

2019-06-28 Thread Charlotte Wood
I need this too!!

On Fri, Jun 28, 2019, 1:22 PM Emmanuel klutse  wrote:

> Hello Team.
> I’m new to programming and I’ve been studying Django for 6 months now. I
> just started my first project and i need help with handling sending emails
> from a user form.
> I am using send_mail function to allow anyone who wants to contact me
> through my contact page. Its is working fine but I need a way for Django to
> allow me get an email from my application using the email address provided
> by the user in fill the form instead of the one I provided in settings.py.
> Please help…. I have been on this for the past one week.
>
> *I’m also available to assisting anyone who needs someone with my level on
> a project for free. *
>
> *Thank you*
> *Emmanuel klutse*
> *+233202729851*
>
> --
> 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/60A5D9BF-5096-4824-90D2-7149E1ACC82E%40gmail.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/CAPZR0N4%3DsjVOSURoF6w72azcNi1V71DiF%2BtT-a_q-r8LAVzkog%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: need help - following django tutorial to create polls database - missing "on delete cascade" - using django 2.2.1 with mysql 8.0

2019-06-28 Thread Joe Reitman
The notes say:

   - The exact output will vary depending on the database you are using. 
   The example above is generated for* PostgreSQL.*

Are you using the default SQLite?

You could try running migrate and then checking the tables to see if the 
constraint was added using a DB admin viewer.

For SQLite I use - https://sqlitebrowser.org/
For Postgres  - https://www.pgadmin.org/



On Tuesday, May 28, 2019 at 7:44:44 PM UTC-5, K Tan wrote:
>
> Hi, everyone,
>
> This is my first time using Django and I think I'm missing something or 
> there is a bug. I am following the instructions on (
> https://docs.djangoproject.com/en/2.2/intro/tutorial02/) and I've just 
> added the following chunk of code to "polls/models.py". (I copied/pasted so 
> I know it's correct.)
>
> 
> from django.db import models
>
>
> class Question(models.Model):
> question_text = models.CharField(max_length=200)
> pub_date = models.DateTimeField('date published')
>
>
> class Choice(models.Model):
> question = models.ForeignKey(Question, on_delete=models.CASCADE)
> choice_text = models.CharField(max_length=200)
> votes = models.IntegerField(default=0)
> 
>
>
> Then I ran the following command:
>
> 
> LITTLEBLACK:www samktan$ python3 manage.py makemigrations polls
> Migrations for 'polls':
>   polls/migrations/0001_initial.py
> - Create model Question
> - Create model Choice
> 
>
> Which is missing one line compared to the tutorial:
>
> - Add field question to choice
>
>
>
> Now when I run this command:
>
> 
> LITTLEBLACK:www samktan$ python3 manage.py sqlmigrate polls 0001
> BEGIN;
> --
> -- Create model Question
> --
> CREATE TABLE `polls_question` (`id` integer AUTO_INCREMENT NOT NULL 
> PRIMARY KEY, `question_text` varchar(200) NOT NULL, `pub_date` datetime(6) 
> NOT NULL);
> --
> -- Create model Choice
> --
> CREATE TABLE `polls_choice` (`id` integer AUTO_INCREMENT NOT NULL PRIMARY 
> KEY, `choice_text` varchar(200) NOT NULL, `votes` integer NOT NULL, 
> `question_id` integer NOT NULL);
> ALTER TABLE `polls_choice` ADD CONSTRAINT 
> `polls_choice_question_id_c5b4b260_fk_polls_question_id` FOREIGN KEY 
> (`question_id`) REFERENCES `polls_question` (`id`);
> COMMIT;
> 
>
> It is missing the "on delete cascade" clause, which I suspect it caused by 
> the missing line above.
>
> I have confirmed in MySQL that the "on delete cascade" clause is 
> definitely missing.
>
> 
> mysql> show create table `polls_choice`;
>
> +--+-+
> | Table| Create Table 
> 
> 
> 
> 
> 
>|
>
> +--+-+
> | polls_choice | CREATE TABLE `polls_choice` (
>   `id` int(11) NOT NULL AUTO_INCREMENT,
>   `choice_text` varchar(200) COLLATE utf8mb4_general_ci NOT NULL,
>   `votes` int(11) NOT NULL,
>   `question_id` int(11) NOT NULL,
>   PRIMARY KEY (`id`),
>   KEY `polls_choice_question_id_c5b4b260_fk_polls_question_id` 
> (`question_id`),
>   CONSTRAINT `polls_choice_question_id_c5b4b260_fk_polls_question_id` 
> FOREIGN KEY (`question_id`) REFERENCES `polls_question` (`id`)
> ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci |
>
> 

Sending Email from form

2019-06-28 Thread Emmanuel klutse
Hello Team. 
I’m new to programming and I’ve been studying Django for 6 months now. I just 
started my first project and i need help with handling sending emails from a 
user form.
I am using send_mail function to allow anyone who wants to contact me through 
my contact page. Its is working fine but I need a way for Django to allow me 
get an email from my application using the email address provided by the user 
in fill the form instead of the one I provided in settings.py.
Please help…. I have been on this for the past one week. 

I’m also available to assisting anyone who needs someone with my level on a 
project for free. 

Thank you
Emmanuel klutse
+233202729851

-- 
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/60A5D9BF-5096-4824-90D2-7149E1ACC82E%40gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: need help - following django tutorial to create polls database - missing "on delete cascade" - using django 2.2.1 with mysql 8.0

2019-06-28 Thread Jasmine Smith
Looking into, will get back to you soon. Thanks.

On Thu, Jun 27, 2019 at 8:15 PM Rudy Quiroga Gamboa 
wrote:

> Hi, I have the same problem, did you find the problem or the solution ?
>
>
> El martes, 28 de mayo de 2019, 20:44:44 (UTC-4), K Tan escribió:
>>
>> Hi, everyone,
>>
>> This is my first time using Django and I think I'm missing something or
>> there is a bug. I am following the instructions on (
>> https://docs.djangoproject.com/en/2.2/intro/tutorial02/) and I've just
>> added the following chunk of code to "polls/models.py". (I copied/pasted so
>> I know it's correct.)
>>
>> 
>> from django.db import models
>>
>>
>> class Question(models.Model):
>> question_text = models.CharField(max_length=200)
>> pub_date = models.DateTimeField('date published')
>>
>>
>> class Choice(models.Model):
>> question = models.ForeignKey(Question, on_delete=models.CASCADE)
>> choice_text = models.CharField(max_length=200)
>> votes = models.IntegerField(default=0)
>> 
>>
>>
>> Then I ran the following command:
>>
>> 
>> LITTLEBLACK:www samktan$ python3 manage.py makemigrations polls
>> Migrations for 'polls':
>>   polls/migrations/0001_initial.py
>> - Create model Question
>> - Create model Choice
>> 
>>
>> Which is missing one line compared to the tutorial:
>>
>> - Add field question to choice
>>
>>
>>
>> Now when I run this command:
>>
>> 
>> LITTLEBLACK:www samktan$ python3 manage.py sqlmigrate polls 0001
>> BEGIN;
>> --
>> -- Create model Question
>> --
>> CREATE TABLE `polls_question` (`id` integer AUTO_INCREMENT NOT NULL
>> PRIMARY KEY, `question_text` varchar(200) NOT NULL, `pub_date` datetime(6)
>> NOT NULL);
>> --
>> -- Create model Choice
>> --
>> CREATE TABLE `polls_choice` (`id` integer AUTO_INCREMENT NOT NULL PRIMARY
>> KEY, `choice_text` varchar(200) NOT NULL, `votes` integer NOT NULL,
>> `question_id` integer NOT NULL);
>> ALTER TABLE `polls_choice` ADD CONSTRAINT
>> `polls_choice_question_id_c5b4b260_fk_polls_question_id` FOREIGN KEY
>> (`question_id`) REFERENCES `polls_question` (`id`);
>> COMMIT;
>> 
>>
>> It is missing the "on delete cascade" clause, which I suspect it caused
>> by the missing line above.
>>
>> I have confirmed in MySQL that the "on delete cascade" clause is
>> definitely missing.
>>
>> 
>> mysql> show create table `polls_choice`;
>>
>> +--+-+
>> | Table| Create Table
>>
>>
>>
>>
>>
>>|
>>
>> +--+-+
>> | polls_choice | CREATE TABLE `polls_choice` (
>>   `id` int(11) NOT NULL AUTO_INCREMENT,
>>   `choice_text` varchar(200) COLLATE utf8mb4_general_ci NOT NULL,
>>   `votes` int(11) NOT NULL,
>>   `question_id` int(11) NOT NULL,
>>   PRIMARY KEY (`id`),
>>   KEY `polls_choice_question_id_c5b4b260_fk_polls_question_id`
>> (`question_id`),
>>   CONSTRAINT `polls_choice_question_id_c5b4b260_fk_polls_question_id`
>> FOREIGN KEY (`question_id`) REFERENCES `polls_question` (`id`)
>> ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci |
>>
>> +--+-+
>> 1 row in set (0.00 sec)
>> 
>>
>> Can someone tell me what I'm doing wrong?
>>
>>
>> --
>>
>> / per ardua ad astra /
>>
>> --
> 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 

Modal Form reusable.

2019-06-28 Thread Julio Parra-Sanchez
Buenos Dias Amigos,

Alguno de ustedes ha utilizado los modal de bootstrap y reutilizarlo como
template, pasandole como variable el modal que van a renderizar?

Gracias y espero me haya explicado bien.
--
Hello Guys,
Have any of you used bootstrap's manners and reused it as a template,
passing as a variable the modal to render it?
thanks

-- 
{
name : "Julio Parra Sanchez",
title: "Apprentice Developer",
company  : "Techtonic",
location : "Denver, CO"
}

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


Feature Request: set default model primary key to UUID or something else for entire project

2019-06-28 Thread Brian Carter
I am aware that I can specify any model's primary key by adding that kwarg 
to a field within the model. I currently do this with most my models, using 
UUIDField as the primary key:

class MyModel(models.Model):
id = models.UUIDField(primary_key=True, default=uuid.uuid4, 
editable=False)
# Insert rest of fields here

I like UUID for my PK's a lot (I don't want someone able to simply guess at 
what my PK's are because they are just auto-incrementing integers - if 
there is a 74 then its obvious that there is 1-73 as IDs), and it is very 
handy to be able to specify this and overwrite the default AutoField within 
each model.

What I would like is for someway to configure this behavior globally in the 
settings.py project settings. If I desire to change it globally like this, 
I think it reasonable to have a finite list of viable replacements, such as 
UUIDField, to replace it, as the main constraint is uniqueness within the 
DB Table for PK's.

Setting this would make it so I do not have to specify an id field for 
every model to use the UUID PK that I want to use, which would be 
convenient for me. I would also like it to affect the Join Tables created 
by Many to Many Fields

-- 
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/ce3768ba-61ee-4e3e-96ac-9f869737c9ae%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Running tests creates many unnecessary files

2019-06-28 Thread Phako Perez
As per my understanding all test runs in a virtual environment and all 
data(files, variables databases) are deleted once test clmpletes, how are you 
running these test, are you using a specific library from python or using own 
tests in a personal file?

Sent from my iPhone

> On Jun 28, 2019, at 08:43, אורי  wrote:
> 
> Hi,
> 
> I found out that in the directory media of Speedy Net 
> (https://github.com/speedy-net/speedy-net) on my computer, there are more 
> than 200,000 unnecessary files and more than 20,000 folders. I checked the 
> time the files were created and it seems that they were created because I ran 
> Django tests locally. Why are so many files and folders created and remain 
> undeleted after the tests end? I would expect all the temporary files to be 
> deleted when the tests end. We have many tests (I think more than 1,000 tests 
> - https://travis-ci.org/speedy-net/speedy-net/builds/551457609) and I ran 
> them many times but I didn't expect so many unnecessary files to be created 
> on my computer. Is there something I can do to prevent it?
> 
> I just ran all the tests locally now, after I deleted all the previous files 
> and folder in media, and I found out that 903 files and 1,041 folders were 
> created. I'm not sure which of our tests created these files and folders. 
> Most of these files are either .jpg or .dat files. Is it possible to delete 
> all these files automatically after the tests end?
> 
> Thanks,
> אורי
> u...@speedy.net
> -- 
> 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/CABD5YeF9JbEVNz_XvGrSTqjR%3Dj9mWkP3pdYf%2BiET3yzm%2B9j59w%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/BB769359-933B-4570-B24B-819031E9DBB6%40gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Beginner's question regarding prefetch_related

2019-06-28 Thread jjmutumi
Hi there,

I think you can use values() 

 
to do a group by. Something along these lines should be able to do it in 3 
queries:

from django.models import Max


# aggregate grouping by submission then get those assessment objects
latest_assessments = Assessment.objects.values('id', 'submission', latest=
Max('time_stamp'))
assessments = Assessment.objects.filter(id__in=[a['id'] for a in 
latest_assessments])

# map submission_id to the latest assessment
assessments = {a.submission_id: a}

# match latest assessment to submission
submissions = Submission.objects.all()
xs = [(s, assessments.get(s.id, None)) for s in submissions]


On Thursday, 27 June 2019 22:09:29 UTC+3, swimmer wrote:
>
> Dear Django community,
>
> I have a data model that looks like the following:
>
> class Submission(models.Model):
>...
>
> class Assessment(models.Model):
>submission = models.ForeignKey(
>Submission, on_delete=models.CASCADE, related_name='assessments')
>time_stamp = models.DateTimeField() 
>
> And I would like to do something simple such as computing a list of pairs 
> of submissions and their most recent assessments:
>
> qs = Submission.objects.prefetch_related('assessments')
> xs = [(s, s.assessments.latest('time_stamp')) for s in qs.all()]
>
> This seems to be inefficient because the assessments table seems to be 
> queried for each submission.
> I've read about prefetch_related and tried to use it as above but it 
> doesn't seem to have any effect.
> I suppose this is because I try to use 'latest'?
> Is prefetch_related applicable in this case at all or do I need to resort 
> to a different technique like a raw SQL query?
>
> Thanks in advance!
>
> Simon
>

-- 
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/c5366579-3bf5-4fff-be2b-3e869620171a%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Searching with respect to gender and BY name

2019-06-28 Thread jjmutumi
Hello,

I think it should work if you build the query sequentially. Like:

def search(request):
if request.method=='POST':
srch = request.POST['srh']
srchs = request.POST['gender']

if srchs or srch:
query = Snippet.objects
if srch:
query = query.filter(Q(name__istartswith=srch))
if srchs:
query = query.filter(Q(gender__iexact=srchs))

if query.count() > 0:
return render (request,'search.html',{'sr': query})
else:
messages.error(request,'no result found')
return HttpResponse("No name found please Add names ")
else:
return render(request,'search.html')

return render(request,'search.html')

On Friday, 28 June 2019 15:35:09 UTC+3, Surya Adhikari wrote:
>
> # my coding looks like this in views.py but somehow it only search by name 
> no matter which gender i select .what am i doing wrong?
>
> def search(request):
> if request.method=='POST':
> srch = request.POST['srh'] 
> srchs =  request.POST['gender']
>
> if srch and srchs:
> match = Snippet.objects.filter(Q(name__istartswith=srch)) 
> matchs = Snippet.objects.filter(Q(gender__iexact=srchs))
>
> if match and matchs:
> return render (request,'search.html',{'sr':match})
> #return render (request,'search.html',{'sr':match})
> else:
> messages.error(request,'no result found')
> # return HttpResponse("No name found please Add names  ")
>
> else:
> # return HttpResponseRedirect('/search/')
> return render(request,'search.html')
>
> return render(request,'search.html')
>
>

-- 
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/9ebdb12b-c341-4ad4-94bd-d25e1d8372cb%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Internal Server Error

2019-06-28 Thread jjmutumi
Hi there,

It would be helpful if you can look at the logs for your application. Check 
in /var/log/. 

For example you could check:

/var/log/apache2
/var/log/nginx
/var/log/postgresql
/var/log/uwsgi
/var/log/syslog

Which will exist depending on your setup.

You can also configure the email for Django to mail error tracebacks.
See https://docs.djangoproject.com/en/2.2/howto/error-reporting/

On Friday, 28 June 2019 13:09:48 UTC+3, Soumen Khatua wrote:
>
> Hi Folks,
> I'm using digital ocean provided Ubuntu 16.04 version yesterday I was 
> trying to configure PostgreSQL remotely.So I did some changes in this path:
> /etc/postgresql/9.5/main/pg-hba.conf and postgresql.conf. After that I 
> cahnge it as it wasbut still I'm getting Internal server error at the 
> provided IP and also Domain name.
>
> Plase help me guys.
>
> Thank You
>
> Regards,
> Soumen
>

-- 
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/bcf8429f-bea5-4620-9029-928893ffb679%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Running tests creates many unnecessary files

2019-06-28 Thread אורי
Hi,

I found out that in the directory media of Speedy Net (
https://github.com/speedy-net/speedy-net) on my computer, there are more
than 200,000 unnecessary files and more than 20,000 folders. I checked the
time the files were created and it seems that they were created because I
ran Django tests locally. Why are so many files and folders created and
remain undeleted after the tests end? I would expect all the temporary
files to be deleted when the tests end. We have many tests (I think more
than 1,000 tests -
https://travis-ci.org/speedy-net/speedy-net/builds/551457609) and I ran
them many times but I didn't expect so many unnecessary files to be created
on my computer. Is there something I can do to prevent it?

I just ran all the tests locally now, after I deleted all the previous
files and folder in media, and I found out that 903 files and 1,041 folders
were created. I'm not sure which of our tests created these files and
folders. Most of these files are either .jpg or .dat files. Is it possible
to delete all these files automatically after the tests end?

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

-- 
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/CABD5YeF9JbEVNz_XvGrSTqjR%3Dj9mWkP3pdYf%2BiET3yzm%2B9j59w%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Searching with respect to gender and BY name

2019-06-28 Thread Surya Adhikari
# my coding looks like this in views.py but somehow it only search by name 
no matter which gender i select .what am i doing wrong?

def search(request):
if request.method=='POST':
srch = request.POST['srh'] 
srchs =  request.POST['gender']

if srch and srchs:
match = Snippet.objects.filter(Q(name__istartswith=srch)) 
matchs = Snippet.objects.filter(Q(gender__iexact=srchs))

if match and matchs:
return render (request,'search.html',{'sr':match})
#return render (request,'search.html',{'sr':match})
else:
messages.error(request,'no result found')
# return HttpResponse("No name found please Add names  ")

else:
# return HttpResponseRedirect('/search/')
return render(request,'search.html')

return render(request,'search.html')

-- 
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/35681b7b-b12e-45bc-8206-396bd3874266%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Why does SelectDateWidget ignore empty_label when field is required?

2019-06-28 Thread Aaron Scruggs
Greetings,

I have a ModelForm with a required date field that I am using 
SelectDateWidget with. I would like to default the select fields to empty 
placeholder values and force the user to pick a specific date, rather than 
defaulting to the first possible one. However when I pass empty_label to 
the widget the values are ignored, since the field is required. I could 
probably sub-class SelectDateWidget and change it to get the behavior I'm 
looking for, but after looking at the code and documentation it's clear 
that the current behavior is a deliberate choice. My question is: Why are 
placeholders ignored when the date field is required?

My use case doesn't seem that unusual so I'm guessing there's a strong 
reason why it's not supported. I'd love to know what that reason is before 
I go making a mess of things. Any help is much appreciated.

Thanks,

Aaron

-- 
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/45527443-3dcf-4b4e-a66e-5e6aef426de1%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Error when displaying videos on iOS and Safari, but fine in Chrome

2019-06-28 Thread Walker O'Brien
They’re either mp4 mov or m4v video files

Sent from my iPhone

> On Jun 28, 2019, at 6:43 AM, Joe Reitman  wrote:
> 
> What is the format of the video? iOS and Safari won't play back WebM. 
> 
>> On Thursday, June 27, 2019 at 9:16:35 PM UTC-5, Walker Obrien wrote:
>> I have a social media application in the early stages of deployment, and 
>> when videos are uploaded they are getting displayed perfectly fine when 
>> visiting the site on chrome but they are not being displayed correctly when 
>> using iOS or Safari... Any suggestions?
> 
> -- 
> 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/05885ac2-87ab-49a0-b005-81f9e337984a%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/39B93DE4-454E-41EB-A3A1-8CF9F6CC773E%40umich.edu.
For more options, visit https://groups.google.com/d/optout.


Re: Error when displaying videos on iOS and Safari, but fine in Chrome

2019-06-28 Thread Joe Reitman
What is the format of the video? iOS and Safari won't play back WebM. 

On Thursday, June 27, 2019 at 9:16:35 PM UTC-5, Walker Obrien wrote:
>
> I have a social media application in the early stages of deployment, and 
> when videos are uploaded they are getting displayed perfectly fine when 
> visiting the site on chrome but they are not being displayed correctly when 
> using iOS or Safari... Any suggestions?
>

-- 
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/05885ac2-87ab-49a0-b005-81f9e337984a%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Internal Server Error

2019-06-28 Thread Soumen Khatua
Hi Folks,
I'm using digital ocean provided Ubuntu 16.04 version yesterday I was
trying to configure PostgreSQL remotely.So I did some changes in this path:
/etc/postgresql/9.5/main/pg-hba.conf and postgresql.conf. After that I
cahnge it as it wasbut still I'm getting Internal server error at the
provided IP and also Domain name.

Plase help me guys.

Thank You

Regards,
Soumen

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


Re: Beginner's question regarding prefetch_related

2019-06-28 Thread swimmer
I want to display a complete list of all submissions, and depending on the 
status of the most recent assessment for each submission,
I want to display some additional information for each submission.
In the system, there might be thousands of submissions and a handful of 
assessments for each of them.

On Thursday, June 27, 2019 at 11:02:25 PM UTC+2, Charlotte Wood wrote:
>
> What are you trying to do?
>
> On Thu, Jun 27, 2019, 2:09 PM swimmer > 
> wrote:
>
>> Dear Django community,
>>
>> I have a data model that looks like the following:
>>
>> class Submission(models.Model):
>>...
>>
>> class Assessment(models.Model):
>>submission = models.ForeignKey(
>>Submission, on_delete=models.CASCADE, related_name='assessments')
>>time_stamp = models.DateTimeField() 
>>
>> And I would like to do something simple such as computing a list of pairs 
>> of submissions and their most recent assessments:
>>
>> qs = Submission.objects.prefetch_related('assessments')
>> xs = [(s, s.assessments.latest('time_stamp')) for s in qs.all()]
>>
>> This seems to be inefficient because the assessments table seems to be 
>> queried for each submission.
>> I've read about prefetch_related and tried to use it as above but it 
>> doesn't seem to have any effect.
>> I suppose this is because I try to use 'latest'?
>> Is prefetch_related applicable in this case at all or do I need to resort 
>> to a different technique like a raw SQL query?
>>
>> Thanks in advance!
>>
>> Simon
>>
>> -- 
>> 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...@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/e38b499f-d54b-4f6a-874b-a95af0b778b0%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/35a5cd29-8975-493f-9111-1f4b380c73ea%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Minimum Hardware requirement - reg

2019-06-28 Thread Raja Sekar Sampath
Thanks to all for the valuable reply

On Wed, 26 Jun 2019 at 08:57, Aldian Fazrihady  wrote:

> Can you convince your client to use clouds instead of self hosting?
> Cloud such as AWS or GCP is easily scriptable, allowing to create
> critical/important automation scripts.
>
> Regards,
>
> Aldian Fazrihady
>
> On Wed, Jun 26, 2019 at 1:19 AM Raja Sekar Sampath 
> wrote:
>
>> Hi,
>>
>> What are the facts to be considered while determine the server
>> configuration for a Django Application?
>>
>> My Client preferring self hosting, the project having 8 different (apps)
>> modules and we expect 20 to 30 users concurrently login into the system and
>> Its having automated cron jobs
>>
>> Thanks & Regards,
>> Raja Sekar Sampath
>>
>> --
>> 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/CAAS5AE6rKGG1Z4LL2SRzQ9X-OE6-HACY41iFrj1qxjRuhU_hxQ%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/CAN7EoAZ_XjXHd%2BJ-Gdd1rNOS4HaTQwZLAVar%3DjfT0kZWB4pSyQ%40mail.gmail.com
> 
> .
> For more options, visit https://groups.google.com/d/optout.
>


-- 
"Making a million friends is not a miracle, the miracle is to make a friend
who will stand by you when a million are against you. "



Have a Smileness Day
With A Smile
Rs.

e-mail: apkra...@gmail.com
Web: https://apkrajar.wordpress.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 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/CAAS5AE7P2k8ApOxzaFawHG4Fyj2_T6rGrAaV%2B479jMKTKm9eEA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.