Re: Unit testing models.py

2018-05-13 Thread 'Anthony Flury' via Django users
I would agree with that - test any custom functionality - * Custom methods (including __str__ and __repr__) * custom managers * Triggers (that maybe save custom fields on update) * validations - testing to ensure that the right validation is performed on that field - i.e. you linked the ri

Re: I canot upload files how can i fix it

2018-05-13 Thread 'Anthony Flury' via Django users
What does the form contain ? Does the web page you get give you an upload button ? Does the code in the view get triggered ? Do you get any errors ? On 13/05/18 04:23, carlos.davalo...@tectijuana.edu.mx wrote:  views def ArticuloFormA(request,Materiaid):     Articulos = Articulo.objects.filt

Re: How Can I Select Date Based on Monday Date?

2018-05-13 Thread Mike Dewhirst
On 14/05/2018 12:11 PM, Alexander Joseph wrote: Thanks Mike, I will check that out! I may have found another solution this afternoon too. Since the user puts in the week start date I think I might be able to use datedelta to the week start date so that Tuesday would be the week start date + de

Re: How Can I Select Date Based on Monday Date?

2018-05-13 Thread Mike Dewhirst
On 14/05/2018 12:11 PM, Alexander Joseph wrote: Thanks Mike, I will check that out! I may have found another solution this afternoon too. Since the user puts in the week start date I think I might be able to use datedelta to the week start date so that Tuesday would be the week start date + de

Re: How Can I Select Date Based on Monday Date?

2018-05-13 Thread Alexander Joseph
Thanks Mike, I will check that out! I may have found another solution this afternoon too. Since the user puts in the week start date I think I might be able to use datedelta to the week start date so that Tuesday would be the week start date + deltadate (1), Wednesday would be the week start date +

Re: How Can I Select Date Based on Monday Date?

2018-05-13 Thread Mike Dewhirst
On 13/05/2018 5:00 AM, Alexander Joseph wrote: I'm building a timesheet app for employees and would like the employees to be able to select a day of the week date based on what the date was on Monday. ie. the user inputs the Monday date of the timesheet, then for each row they need to fill ou

Form disappears after click submit

2018-05-13 Thread aaron newberry
I have a form I am using for a drop down that I would like to stay on the page after submit is clicked. The problem is it disappears after submit. I would like the form drop down to still display after submit. I what it is after submit the form class isnt called again. How do I call the form cla

app.yaml for simple django application for GCP

2018-05-13 Thread Amit kumar
Please help me with configuring my app.yaml for my a simple django app which i want to deploy on GCP. Thanks Regards Amit Kumar -- 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, se

Re: Unit testing models.py

2018-05-13 Thread Jani Tiainen
Hi, In general you don't need to test your models if you don't use anything special there. If you do have properties or methods on models that do something that is good to test that they return correct values or do correct things. On Sun, May 13, 2018 at 7:11 PM, Mark Phillips wrote: > What s

Unit testing models.py

2018-05-13 Thread Mark Phillips
What should be unit tested in models.py? I assume the storing of data and retrieving of data from the database does not need to be tested, as I further assume django has a full set of tests for those operations. I can see testing these parts of models.py * All custom methods * Labels for all fie

Re: Invalid HTTP_HOST header: 'testserver'. You may need to add 'testserver' to ALLOWED_HOSTS.

2018-05-13 Thread Andréas Kühne
Hi, The error is pretty self explanatory. When the test client calls the django server it uses the hostname of testserver. This works while testing and also in development mode as long as you have DEBUG=True in your settings file. If you have changed that to False, django will look in the list of

Re: SQL select statements to Django ORM

2018-05-13 Thread Todor Velichkov
You can use Raw SQL expressions only for the custom field which you want to annotate. MyModel.objects.all().annotate(age=RawSQL("TIMESTAMPDIFF(YEAR, date_of_birth, curdate( On Sunday, May 13, 2018 at 4:4

Invalid HTTP_HOST header: 'testserver'. You may need to add 'testserver' to ALLOWED_HOSTS.

2018-05-13 Thread Avitab Ayan Sarmah
Hi all, while going through the dajngo tutorial i stuck while executing a code i.e., mentioned below. It is shoeing "Invalid HTTP_HOST header: 'testserver'. You may need to add 'testserver' to ALLOWED_HOSTS.". the code is written in python manage.py shell.i.e., PS C:\Users\AVITABAYAN\m