Hi Mark,
On zondag 13 mei 2018 18:11:07 CEST Mark Phillips wrote:
> 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.
You should te
On zondag 13 mei 2018 03:44:37 CEST Gerald Brown wrote:
> As I have said previously, I am new to Django ORM so I would like to know
> howto/find reference to Django ORM Query to the following SQL Select
> statements:
Do you want to use SQL or use Django? Pick one.
> 1. From Mariadb.
>
> SELECT n
Hi everyone, I'm new to python and Django. I also think I am getting it
well. But I have an issue with the first Django app tutorial.
My questions display well redirect to the detail view well and to the vote
view well.
The problem I have is that my question does not display the 'choices' of
ty
Your template looks fine, and as the question_text is displayed correctly,
it probably safe to assume that your view is correct too.
Two things you can check:
- does this question actually have any related choices? You can check in
the admin.
- check your models.py if you actually named the model
Yes, getting the right combination of mod_wsgi in Windows can be tricky.
This URL is most helpful with that:
https://www.lfd.uci.edu/~gohlke/pythonlibs/#mod_wsgi
Be sure to get the Apache with the correct Visual C runtime and the right
number of bits.
No, I don’t uninstall IIS because I’m using i
You could use the ORM to get the difference of two dates like so:
Person.objects.annotate(age=ExpressionWrapper(Cast(Now(), DateField()) -
F('dob'), output_field=DurationField()))
https://docs.djangoproject.com/en/2.0/ref/models/database-functions/#cast
https://docs.djangoproject.com/en/2.0/ref/mo
On maandag 14 mei 2018 15:38:01 CEST Matthew Pava wrote:
> You could use the ORM to get the difference of two dates like so:
> Person.objects.annotate(age=ExpressionWrapper(Cast(Now(), DateField()) -
> F('dob'), output_field=DurationField()))
> https://docs.djangoproject.com/en/2.0/ref/models/datab
Maybe it's just me, but I had a report I was generating that took 3.5 minutes
to complete that utilized for loops and the ORM. I managed to generate the
same report in 18 seconds using a RawSQL query.
So what's the upside? Speed. I would understand if the times were comparable,
but they're no
I'm using Django 1.11. I cannot set dynamic choices for model's field
because:
- choices must be iterable, not function,
- choices iterable is always coverted to list,
- iterable is evaluated oat the module import stage.
The whole thing is about iterable evaluation time. The data sourc
Hello.
For the last 6 years I've been using gevent's greenlets to serve Django
requests, instead of tying up a thread or a process, and this has served me
well for web applications that deal with slow streaming clients, or have to
call some slow external services mid-request, or are just IO-bou
I have a Django app running on a server with uWSGI and nginx.
In my `local_settings.py` file I have this:
###
# EMAIL SETUP #
###
EMAIL_HOST = 'smtp.privateemail.com'
EMAIL_HOST_USER = 'supp...@mydomain.com'
EMAIL_HOST_PASSWORD = 'MY EMAIL PASSWORD
It will be a bit generic help: To understand what's going wrong with your
code when you expect other type of behavior you can use debugging tools
like: pdb or (if you use an IDE like pycharm) build-in IDE debugger
(https://www.jetbrains.com/help/pycharm/debugging-django-templates.html,
https://
Hello André,
> Is there a way to force Django to close the DB connection after each
operation (unless we're in an atomic block)?
The only way I can think of achieving that is by bundling your own database
backend subclass
and override execute() and the cursor subclass to close the connection wh
Ah yes, timedelta, thats what I meant instead of deltadate haha. Thanks
again
On Saturday, May 12, 2018 at 1:00:29 PM UTC-6, 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 wa
On maandag 14 mei 2018 16:42:49 CEST Matthew Pava wrote:
> But if in your use case, you had a million records in which you were trying
> to filter
Full stop right there. No one is filtering anything in the original use case,
so you're comparing apples and oranges.
Filtering you would do in the d
On maandag 7 mei 2018 17:59:02 CEST Daniel Roseman wrote:
> I still don't understand what is being repeated or why. You need to specify
> that in your settings, and you can add whatever context processors you
> like. You don't need to specify it twice, so nothing is being repeated.
What Bernd mean
It was a conditional statement, albeit a seemingly poorly constructed one.
"If you had a million records you were trying to filter..."
Would you not just replace "annotate" with "filter" and use the same
DurationField() expression?
Nevertheless, in my case, I would use the annotation for a repo
Hey All,
So I have a django project in a directory for production. I have the same
exact project in a separate repository for development. I literally have
copied and pasted my project over and the only changes I have made are
switching debug from false to true. So my project has the same da
Hello there, I think the reason is that your login session is stored in the
database. The two programs share a set of databases, so the login status is
synchronized. The corresponding solution, then copy a set of databases, and
clear the current login session. Hope you can solve your problem. be
Hello Simon.
On Monday, May 14, 2018 at 6:15:50 PM UTC+1, Simon Charette wrote:
>
> > Is there a way to force Django to close the DB connection after each
> operation (unless we're in an atomic block)?
>
> The only way I can think of achieving that is by bundling your own
> database backend subc
20 matches
Mail list logo