Misleading 404 exception during unit tests.

2015-03-23 Thread Benjamin Scherrey
Can someone explain the test condition on line 31 of https://github.com/django/django/blob/master/django/contrib/staticfiles/views.py - Just spent a few hours trying to get my unit tests to pass and couldn't figure out what was going on until I found this weirdness. I understand serve() isn't mean

Re: Misleading 404 exception during unit tests.

2015-03-23 Thread Benjamin Scherrey
above link embedded in it. Thanx to Rene Fleschenberg on irc for the doc link. On Mon, Mar 23, 2015 at 8:42 PM, Benjamin Scherrey wrote: > Can someone explain the test condition on line 31 of > https://github.com/django/django/blob/master/django/contrib/staticfiles/views.py > - Jus

Re: Misleading 404 exception during unit tests.

2015-03-23 Thread Benjamin Scherrey
ly sent me on >> a wild goose chase trying to understand the 404 response. Would be VERY >> useful if this 404 at least provided some information as to what it's >> really all about - preferably with the above link embedded in it. >> >> Thanx to Rene Fleschenberg o

Re: Django project for multiple clients

2015-03-31 Thread Benjamin Scherrey
This is what we've done successfully for multiple projects. Django makes it fairly straightforward. -- Ben On Fri, Mar 27, 2015 at 4:37 PM, Gabriel - Iulian Dumbrava < gabriel.dumbr...@gmail.com> wrote: > If your clients are using different subdomains, like client1.webapp.com, > client2.webapp

Improvement to objects.get_or_create and objects.update_or_create

2014-08-25 Thread Benjamin Scherrey
Just want to run an idea by the list for a feature improvement for the oft-used convenience functions get_or_create and update_or_create. I'll just talk about get_or_create for now on but everything I saw going forward applies to both. It's a common idiom to populate a dictionary and simply pass i

Re: Improvement to objects.get_or_create and objects.update_or_create

2014-08-25 Thread Benjamin Scherrey
e designed carefully, will be less explicit than a piece > of a python tool should be. > > > On Monday, August 25, 2014, Benjamin Scherrey > wrote: > >> Just want to run an idea by the list for a feature improvement for the >> oft-used convenience functions get_or_cre

Re: How quickly do Django unit tests run?...

2014-08-27 Thread Benjamin Scherrey
Something's definitely wrong. Except for the initial setup for the test run (in 1.7 migrations run each time for example), the individual tests should execute as fast as any normal python unit test. On Wed, Aug 27, 2014 at 9:06 PM, Fred Stluka wrote: > How quickly do Django unit tests run? > >

Re: problem importing blank date using https://github.com/edcrewe/django-csvimport

2014-08-27 Thread Benjamin Scherrey
Unfortunately python's csv capabilities have a fundamental problem - they can't express null/None content. Any empty content will always show up as an empty string ''. So what's being pass to your date constructor is an empty string which is not a valid date format. Best work around is to generally

Re: How quickly do Django unit tests run?...

2014-08-27 Thread Benjamin Scherrey
t; --Fred > -- > Fred Stluka -- mailto:f...@bristle.com -- > http://bristle.com/~fred/ > Bristle Software, Inc -- http://bristle.com -- Glad to be of service! > Open Source: Without walls and fences, we need no Windows or Gates. > ---

Re: How quickly do Django unit tests run?...

2014-08-27 Thread Benjamin Scherrey
nc -- http://bristle.com -- Glad to be of service! > Open Source: Without walls and fences, we need no Windows or Gates. > -- > On 8/27/14 4:21 PM, Benjamin Scherrey wrote: > > Clearly that depends on what your tests do. One of our projects runs ~400 > test

Re: How quickly do Django unit tests run?...

2014-09-02 Thread Benjamin Scherrey
bristle.com -- > http://bristle.com/~fred/ > Bristle Software, Inc -- http://bristle.com -- Glad to be of service! > Open Source: Without walls and fences, we need no Windows or Gates. > -- > On 8/27/14 5:22 PM, Benjamin Scherrey wrote: > > Postgres.

Re: ORM performance

2014-09-03 Thread Benjamin Scherrey
The short answer to your question is no, the Django ORM is not inherently slower in that regard and it's very likely something you're doing. The useful answer is probably more complicated. :-) Naive usage of the ORM without an understanding of how it translates to SQL is likely to result in some re

Re: Models inside tests - Django 1.7 problem

2014-09-05 Thread Benjamin Scherrey
I'm not sure what the specific issue with migrations is but this article has a nice trick (intended for making temporary models/tables) that would allow you to bring in a model and get it to sync whenever you like. I'd suggest putting this in your test setUp() method. It uses 'syncdb' cause it's pr

How to express a seemingly straightforward upate in the ORM?

2014-09-07 Thread Benjamin Scherrey
I've got an application that needs to frequently update a boolean value (ChannelItem.channel_stocks) against a temporary table that gets created and lives just long enough for this transaction. The table is simply a list of alpha-num skus and created like this: cursor.execute("create temporary tab

Issue with models.FilePathField in Django 1.7 Admin?

2014-09-10 Thread Benjamin Scherrey
I have a model with a FilePathField declared as follows: ftp_path = models.FilePathField(path=settings.BASE_SFTP_DIRECTORY, max_length=250, allow_files=False, recursive=True, allow_folders=True, blank=True) In my save command

Re: Issue with models.FilePathField in Django 1.7 Admin?

2014-09-12 Thread Benjamin Scherrey
Yes that all works. My unit tests and when reviewing the resulting objects via the django shell show everything is absolutely working and the content of my FilePathField data is correct. It's only the Admin UI that is giving me fits. thanx, -- Ben On Thu, Sep 11, 2014 at 11:19 PM, Collin Ander

Re: How to express a seemingly straightforward upate in the ORM?

2014-09-12 Thread Benjamin Scherrey
I should assume then that this is something that the existing Django ORM cannot model? -- Ben On Mon, Sep 8, 2014 at 1:06 PM, Benjamin Scherrey wrote: > I've got an application that needs to frequently update a boolean value > (ChannelItem.channel_stocks) against a temporary tabl

Re: Preventing illegal method calls

2014-09-14 Thread Benjamin Scherrey
This is the nature of the HTTP protocol and RESTful architectural style. Understand that a URI is just an address for a resource - it is not an action or command. The HTTP verbs are the actual commands. So which HTTP verb you send determines what action you want to occur on that resource. This mean

Re: Admin doesn't show all entities

2014-09-20 Thread Benjamin Scherrey
Yikes that's scary. How did you diagnose this? I think I may be hitting a few examples of this now as well. Silent repression of exceptions is about as evil a thing as one can do in a framework/library. On Sat, Sep 20, 2014 at 6:31 AM, Collin Anderson wrote: > This happened to me once when using

Re: Upgrading Django (to 1.7)

2014-09-26 Thread Benjamin Scherrey
Great summary - looking forward to the rest. Especially like some of the backgrounder insights also explaining "why" certain things were done. I think this often helps developers understand and use features better than even the otherwise excellent and detailed online docs. Wonder if the Django doc

Re: Full text search available on PostgreSQL?

2014-10-07 Thread Benjamin Scherrey
Did you find a solution that worked with ModelAdmin.search_fields & Postgres? I'm running into the same question. thanx, -- Ben On Sat, Jun 28, 2014 at 11:15 PM, Bastian Kuberek wrote: > Hi, > > Just saw that django.contrib.admin.ModelAdmin.search_fields >

Trying to overload Django 1.9 JSONField

2016-08-28 Thread Benjamin Scherrey
I have an application where we've upgraded from Django 1.7 to 1.9 that makes extensive use of the new Postgres JSONField type. Now that JSONField is native to Django I'm trying to get it to work with our existing code base. We have a class that won't automatically serialize to json so I've extended