Re: Races in sessions

2021-02-07 Thread Stephen J. Butler
The way I'd solve this example is to create a unique constraint/index in the DB. The session check gives a quick pre-check, but in the event of a race the DB enforces absolute consistency. If the constraint isn't possible or is too complex, then your "SELECT... FOR UPDATE" belongs on the check for

Re: Oracle DB table prefix missing

2019-09-17 Thread Stephen J. Butler
Maybe I'm misunderstanding, but tablespace has to do with physical storage of the schema, not how tables are named. What you really want is a db_schema_name or something. I think this long, old ticket is related https://code.djangoproject.com/ticket/6148 On Tue, Sep 17, 2019 at 10:27 AM Christian

Re: Use migrations api to create a command for data migration between different databases

2016-06-10 Thread Stephen J. Butler
I usually just use dumpdata/loaddata to do these kinds of things. On Fri, Jun 10, 2016 at 12:47 PM, Bruno Ribeiro da Silva < bruno.dev...@gmail.com> wrote: > Hey guys, I'm not sure if I should be asking this here, but it's related > to django internals. > > I have this idea to create a command th

Re: Threads and db connection handling question

2016-06-02 Thread Stephen J. Butler
Do you expect your background threads to be equivalent to or greater than the number of requests you're normally servicing? Usually background tasks are much less frequent than the web requests, so a little overhead w/r/t database connections isn't even going to be noticed. Looking at what Django

Re: Threads and db connection handling question

2016-06-02 Thread Stephen J. Butler
I'm still a bit confused. What is the advantage of having connections closed automatically when the thread exits? It seems to me that you can quickly solve your problem by modifying your thread start routines: from django.db import connection from contextlib import closing def my_thread_start():

Re: Threads and db connection handling question

2016-06-01 Thread Stephen J. Butler
Is there a good reason to do this with your own custom thread pool management inside Django and (I'm assuming) WSGI? Celery is a well understood solution to the problem of background tasks and has a really nice API. On Wed, Jun 1, 2016 at 5:34 PM, Cristiano Coelho wrote: > Let me start saying so

Re: An idea for Q filter objects

2016-03-30 Thread Stephen J. Butler
I guess you could! I'm not as familiar with the Transforms API, but it looks like it would work too. On Wed, Mar 30, 2016 at 6:17 PM, Shai Berger wrote: > On Tuesday 29 March 2016 05:07:14 Stephen J. Butler wrote: > > Why not do this in the database? Create a view with an extra co

Re: An idea for Q filter objects

2016-03-28 Thread Stephen J. Butler
Why not do this in the database? Create a view with an extra column that is called "field_dttxt" that is to_char(field, 'Mon DD, '). Then add this as a field to Django and let it use the normal Q lookups. On Mon, Mar 28, 2016 at 5:13 PM, Michael E wrote: > I don't know if this is possible, b

Re: templates: override inner nested block

2015-05-25 Thread Stephen J. Butler
On Sun, May 24, 2015 at 6:28 AM, anentropic wrote: > Currently there is a problem (correct me if wrong) when you need to override > the content of an inner nested block. > > {% block parent %} > some stuff > {% block child %} > child stuff > {% endblock %} > some other stuff > {% endb

Re: New function to sort words with accents.

2015-05-05 Thread Stephen J. Butler
This is part of the database collation, and as I understand the Django docs it's not something Django handles internally. It's something you set/tweak inside your database. What database are you using? On MySQL the docs say to set a column collation. On Oracle I believe you can change the NLS_SORT

Re: CSRF REASON_NO_REFERER with meta referrer tags

2015-02-03 Thread Stephen J. Butler
On Tue, Feb 3, 2015 at 1:39 PM, Aymeric Augustin wrote: > Le 3 févr. 2015 à 16:54, Jon Dufresne a écrit : >> Assuming this MITM already has the correct CSRF value, what is >> stopping this MITM from adding a REFERER to the HTTPS request? > > While MITM of HTTP is trivial, MITM of HTTPS isn't poss

Re: Querying across FK produces too many OUTER JOINs (1.6) or FieldError (1.7)

2014-07-04 Thread Stephen J. Butler
On Fri, Jul 4, 2014 at 4:42 PM, Jon Dufresne wrote: > Suppose I have the following models: > > --- > class Container(models.Model): > pass > > class Item(models.Model): > container = models.ForeignKey(Container) > previous = models.ForeignKey('self', null=True) > current = models.