ednesday, February 10, 2021 at 9:32:31 PM UTC-5 Roy Smith wrote:
> I've gotten back to playing with this. What I've ended up doing is
> monkey-patching render to send the signal django.test.Client is expecting
> from the template backend. Paraphrasing my (python 3.7)
bruary 4, 2021 at 7:29:23 PM UTC-5 Roy Smith wrote:
> I started my current project using native django templates and now I'm
> converting to jinja2. For the most part, it has gone smoothly.
>
> The surprising roadblock was that this broke all my unit tests. The issue
> i
It's a known problem. See https://code.djangoproject.com/ticket/24622. In
short, the django template code has hooks to populate these values in the
test client's response. The jinja folks (understandably) don't want to add
the same hooks.
On Friday, February 5, 2021 at 1:37:10 AM UTC-5 Benny
I started my current project using native django templates and now I'm
converting to jinja2. For the most part, it has gone smoothly.
The surprising roadblock was that this broke all my unit tests. The issue is
that django.template.backends.jinja2.Jinja2 doesn't populate response.context.
I'm running django 2.2.
My static directory has a subdirectory which I want to deploy, but as far as I
can tell, staticfiles only finds files in the top-level static directory. is
there any way to make it recurse and find everything below the static
directory, and keep the same directory struc
Hmmm, maybe related to https://code.djangoproject.com/ticket/26665 ?
On Thursday, August 27, 2020 at 5:29:39 PM UTC-4 Roy Smith wrote:
> I'm running:
>
> Python 3.7
> Django 2.2
> Debian 4.9
>
> If I configure a forms ChoiceField with a callback function for choices,
&
I'm running:
Python 3.7
Django 2.2
Debian 4.9
If I configure a forms ChoiceField with a callback function for choices, it
gets called twice each time I render the form:
> from unittest import TestCase
> from django import forms
>
> def callback():
> print("callback")
> return [('foo',
I got this figured out. It turns out I had a dependency on social_auth in an
entirely different part of my code where I execute
reqeust.user.social_auth.get(provider='mediawiki').extra_data['access_token']
regardless of what auth backend was actually used.
> On Aug 4,
I have both model and social backends configured in settings.py:
> AUTHENTICATION_BACKENDS = (
> 'django.contrib.auth.backends.ModelBackend',
> 'social_core.backends.mediawiki.MediaWiki',
> )
When I run this test:
> from django.test import TestCase, Client
> from django.contrib.auth.mod
Oh, never mind. It turns out 'logging.handlers.DatagramHandler' is exactly
what you need, I just didn't get all the pieces wired up right.
> On Jun 28, 2020, at 9:20 PM, Roy Smith wrote:
>
> 'logging.handlers.DatagramHandler',
--
You received this mes
Correction, the line that says 'logging.handlers.DatagramHandler', really reads
'logging.DatagramHandler' in the code I'm running. The
logging.handlers.DatagramHandler was just something I tried to see what it
would do.
> On Jun 28, 2020, at 9:17 PM, Roy Smi
Python 3.7.3
Django 2.2.13
Debian Linux
I'm trying to configure a DatagramHandler for logging. My LOGGING config is:
LOGGING = {
'version': 1,
'disable_existing_loggers': False,
'handlers': {
'file': {
'level': 'DEBUG',
'cla
)
4) No
On Dec 22, 2014, at 9:02 PM, Roy Smith wrote:
> I'm in the process of incrementally upgrading a site running some ancient
> software (django 1.3.1 and django-cms 2.2). I've got a development version
> of the site running django-cms 2.3.8 (and still django 1.3.1) for t
s version change how this behaves?
3) Is this fixed in later django-cms versions?
4) Is this fundamentally a bug in Google calendar, i.e. I should be reporting
it to them?
--
Roy Smith
r...@panix.com
--
You received this message because you are subscribed to the Google Groups
"Django use
I'm running django (1.4) with gunicorn (0.17.4) and gevent. I want to have
the gunicorn worker number available inside of django, so I can include it
in log messages and statsd data for tracking purposes.
What I'm doing right now is I put a pre_request hook in my gunicorn config
file which fak
ckling all over again.
Is there any way to find out how much memory each object I store is going to
use without this extra overhead?
---
Roy Smith
r...@panix.com
--
You received this message because you are subscribed to the Google Groups
"Django users" group.
To unsubscribe from
ted. Is there a way to also get
the value, inside the atomic perimeter?
--
Roy Smith
r...@panix.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 e
In core/handlers/base.py, handle_uncaught_exception() does:
if settings.DEBUG:
from django.views import debug
return debug.technical_500_response(request, *exc_info)
logger.error('Internal Server Error: %s' % request.path,
exc_info=exc_info,
We're using django.contrib.sessions.backends.cache. We use mongodb for our
datastore, so we don't use the django model/database support at all.
The standard django session machinery generates 32-character hex strings
(128 bits) for session ids. We store the session_id in many places in our
da
I'm just staring to explore admin actions. I'm surprised to see that you have
to set the description by doing:
my_action_function.short_description = "blah"
wouldn't it be cleaner to just declare a doc string for the action function and
have short_description grabbed
What tools exist to monitor django's cache usage? I'd like to see things like
number of keys stored, total amount of memory used, hit rates broken down by
key prefix, that sort of thing.
We're using django.core.cache.backends.memcached.MemcachedCache.
---
Roy Smith
r...@pan
False, my field it
omitted entirely from the admin.
What's the intent of editable? Is this a bug, or is the description in the
docs just misleading?
--
Roy Smith
r...@panix.com
--
You received this message because you are subscribed to the Google Groups
"Django users" g
I'm working on a site which makes extensive use of admin, and we're
starting to look at extending/customizing it. I am aware of
django-admin-tools and django-grappelli. Are there other projects I should
be looking at for admin extension/customization ideas?
--
You received this message becau
On Saturday, April 28, 2012 10:35:40 AM UTC-4, Shawn Milochik wrote:
>
> Override the save() method to raise an exception if "self.id is not
> None."
>
But, that still doesn't tell the admin interface to *show* the fields as
read-only (which is really what I'm interested in). If I raise an
I've got a model that looks something like this:
class Image(Model):
name = CharField(max_length=40)
class ImageVersion(Model):
image = ForeignKey(Image)
upload_date = DateTimeField(auto_now_add=True)
data = ImageField(upload_to="images/learncms")
I want all the data in an ImageV
Oh, I see what's going on. I marked the field as readonly. Apparently the
widget only gets created if the field is editable (I guess that makes sense).
On Apr 25, 2012, at 1:28 PM, Roy Smith wrote:
> Ooops, forgot to mention, I'm using django 1.4.
>
>
> On Apr 25,
Ooops, forgot to mention, I'm using django 1.4.
On Apr 25, 2012, at 12:51 PM, Roy Smith wrote:
> I'm trying to get the admin to give me a thumbnail for an ImageForm.
> Following the suggestion at http://djangosnippets.org/snippets/1580/, I've
> got the following code:
ionAdmin)
The problem is, I'm still getting the standard admin display. I stuck the
"assert 0" in AdminImageWidget.__init__() just to prove that it's never being
called. What magic am I missing?
My model looks like:
class ImageVersion(Model):
image = ForeignKey(Image)
ut that just raises: "TemplateView() received an invalid
keyword 'extra_context'". What am I missing here?
--
Roy Smith
r...@panix.com
--
You received this message because you are subscribed to the Google Groups
"Django users" group.
To post to this group, send emai
> serial = AutoField()
I get an error when I do syncdb or schemamigration:
> AssertionError: AutoFields must have primary_key=True.
Is this a bug?
---
Roy Smith
r...@panix.com
--
You received this message because you are subscribed to the Google Groups
"Django users" group.
To post
I've got a model in django 1.4:
class Image(Model):
serial = AutoField(primary_key=True)
version = IntegerField(default=1)
I want (serial, version) to be unique. Is there a way to express that in the
model layer?
---
Roy Smith
r...@panix.com
--
You received this message becaus
"pk": 9,
"model": "contenttypes.contenttype",
"fields": {
"model": "gallery",
"name": "gallery",
"app_label": "photologue"
}
},
but that's the only entry fo
On Sunday, April 8, 2012 4:34:26 PM UTC-4, Roy Smith wrote:
>
> I'm trying to install django-tinymce 1.5.1b2 into a django-1.3 site. The
> installation instructions say:
>
> "Copy the jscripts/tiny_mce directory from the TinyMCE distribution into
> a directory name
>
> docs are little out of date but should work.
> http://django-tinymce.readthedocs.org/en/latest/installation.html
>
Thanks for the help. The critical item was, "If you are using
django-staticfiles you can skip this step". I added 'tinymce' to
INSTALLED_APPS, set
TINYMCE_DEFAULT_CONFIG = {
I'm trying to install django-tinymce 1.5.1b2 into a django-1.3 site. The
installation instructions say:
"Copy the jscripts/tiny_mce directory from the TinyMCE distribution into a
directory named js in your media root. You can override the location in
your settings (see below)."
But there is n
In the default settings.py file, the timezone is set to:
TIME_ZONE = 'America/Chicago'
Why? Wouldn't None (to match the server's time zone) be a more sane
default? Even setting it to UTC would be more reasonable than setting it
to any specific timezone, but surely going with the system defaul
I'm mystified why django (under runserver) is not finding my static
files. I'm running django-1.3.1. The relevant parts of my
settings.py file are:
STATIC_ROOT = os.path.join(PROJECT_DIR, 'static')
STATIC_URL = '/static/'
I have a file in my static directory, a file named foo. If I do a GET
on
Ugh, I got it figured out. I totally misunderstood what the docs were
saying. I was thinking that somehow the django.request logger
magically found the request object and stuck it into the context.
That's not what it was saying at all. All the quote from the docs
really means is that all the pla
I'm running django 1.3, python 2.6. I'm trying to write a custom
formatter for the django.request logger. I need to log one of the
headers from the HTTP request. The documentation for django.request
(https://docs.djangoproject.com/en/1.3/topics/logging/) says:
Messages to this logger have t
We've got an application which does lots of AJAX calls and sometimes
(intentionally) abandons the TCP connection before getting a
response. These result in django dumping a stack trace to stderr (see
example below).
The question is, why does this get written directly to stderr? It
happens in Ser
the Google Groups
> "Django users" group.
> To post to this group, send email to django-users@googlegroups.com.
> To unsubscribe from this group, send email to
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/grou
n
port 80 (which is the wrong place; the nginx config would route to the django
side).
It seems like a django bug that the string I pass HttpResponseRedirect is
modified before generating the location header. What do you guys think?
---
Roy Smith
r...@panix.com
--
You received this message
I'm running django 1.3. If I access HttpRequest.META['SERVER_PORT'],
I get back a string (i.e. "80"). I was expecting an integer. Is this
a bug (in which case I'll open a ticket to fix it) or it it
intentional that it's returning a string (in which case I'll open a
ticket to document it better).
I assume that User.username is constrained to be unique, but I don't
actually see that stated anywhere. Is it? And, assuming it is, what
happens when you call create_user() with a username that's already
taken? Is all this documented somewhere and I'm just not finding it?
--
You received this
I'm exploring packages to use MongoDB with django. So far, I've
found:
* DjanMon (https://github.com/mdirolf/djanMon/)
* Mongoengine (http://mongoengine.org)
* MongoKIT
* Mango
* Pymongo-bongo
* Mongodb-engine (https://github.com/django-mongodb-engine/mongodb-
engine)
* Django-nonrel (http://www.
Exactly what I was looking for. Thanks!
--
You received this message because you are subscribed to the Google Groups
"Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to
django-users+unsubscr...@googlegroups.com
I want to catch any exceptions thrown in my views (or anywhere else, I
suppose) and log a full stack trace. I know I can write middleware
which implements process_exception(), but that just gets me the naked
exception object, not a full stack dump. I'm assuming that by the
time my process_excepti
We're using django as a front end to a pre-existing web site
implemented in PHP. The PHP code has a vaguely RESTful interface,
where you can make HTTP calls on it and get back JSON-ized data. The
django layer sits in front of that and talks directly to the browser.
We're not using any models in d
For diagnostic purposes, I want every one of my templates to emit an
HTML comment showing the template name. I was doing fine just
dropping "", etc, in each template, until the first
time I renamed a template and forgot to update the comment :-)
Any way to automate this process so I can do ""?
-
> > if form.is_valid():
> > f = request.FILES['file']
> > data_set = DataSet()
> > data_set.save('foo', f)
>
> I suspect this is the problem: you create an empty instnce of DataSet
> and then call its save method. model.save has three optional arguments
> [1]
I'm trying to figure out how to upload a file. I've got a model that
looks like:
class DataSet(models.Model):
file = models.FileField(upload_to='data/%Y/%m/%d')
and my view method is:
def create_data_set(request):
if request.method == 'POST':
form = DataSetForm(request.POST,
If I set:
DEBUG = False
in my settings.py file, my site runs and produces the correct HTML,
but there's no style sheets loaded. Even stranger, if I save the HTML
generated each way into files and compare them, they're identical!
Any clue what might be causing the style sheets not to load with D
N_BACKENDS = (
'django.contrib.auth.backends.ModelBackend',
'socialregistration.auth.FacebookAuth',
)
On Apr 26, 2011, at 12:56 PM, Roy Smith wrote:
> I've got a test case that essentially looks like this:
>
>
I've got a test case that essentially looks like this:
--
from django.test import TestCase
from django.test.client import Client
from django.contrib.auth.models import User
class ApiTest(TestCase):
def test_login(
Do-oh! All I needed to do was
t = template.loader.get_template('collage/item-component.html')
return t.render(context)
On Apr 7, 2011, at 11:14 PM, Roy Smith wrote:
> You can't call render_to_response() from inside a tag. Or can you?
--
Roy Sm
register.tag('item_html', do_item_html)
--
Roy Smith
r...@panix.com
--
You received this message because you are subscribed to the Google Groups
"Django users" group.
To post to this group, send email to django-users@googlegroup
On Wed, 2011-04-06 at 15:13 -0700, Tony wrote:
> so I have two models, A and B. B has a foreignkey relationship in it
> from A (To be clear because I know I dont explain it that well, one A
> has many Bs). for each group of Bs each A is connected with, I want
> there to be a way to mark one of th
On Wed, 2011-04-06 at 12:51 -0700, Mike Ramirez wrote:
> the form widgets accept a key word arguement of "attrs"[1] which takes a
> dictionary that has the key as the option and the value is the options fale.
> i.e.: attrs={'readonly': 'true'}. These are added to the field when it's
> rendered
I want to display an object in exactly the same style as an existing
template that looks like this:
{% csrf_token %}
{{form}}
except that I want all the fields to be read-only. It's easy enough
to not include the submit button, but I also want to add
readonly="true" attributes to all the t
I'm using django-1.3 . I have a view with the following code:
def item_create(request):
if request.method == 'POST':
form = ItemForm(request.POST)
if form.is_valid():
url = form.cleaned_data['url']
item.save()
return HttpResponseRedirect('/'
Weird choice of name for this project. Should have been
"djohnny-cache" :-)
On Mon, 2011-04-04 at 13:13 -0700, Charlie Offenbacher wrote:
> I read the docs (and the issues in their bug tracker), but my
> impression was that the main incompatibility with Django 1.3 is
> transactions, which we're
On Apr 3, 4:58 pm, Shawn Milochik wrote:
> In short, it has to be on your PYTHONPATH or in the local directory.
OK, then I'm still not getting how this works. The full path to my
setting and urls files are:
/Users/roy/s7/soco/soco-site/settings.py
/Users/roy/s7/soco/soco-site/urls.py
If I have
On Apr 3, 2:55 pm, andy wrote:
> Well I'm guess you don't have to. Both ROOT_URLCONF = "foo.urls" and
> ROOT_URLCONF = "urls" seem to work fine.
Interesting, I just tried it that way, and sure enough it does work.
I had simply been following the examples in the tutorial, which showed
the foo.urls
I don't understand how ROOT_URLCONF is declared in settings.py. If I
put all my apps (and my settings.py file) in a directory "foo", I'm
supposed to do:
ROOT_URLCONF = "foo.urls"
This seems counter-intuitive to me. When I run my app (by running
"python manage.py runserver"), I'm already in the
I'm running r15624, OSX-10.6.5, Python-2.6.1
In my top-level urls.py, I have:
# Serve static
files
(r'^static/(?P.*)$',
'django.views.static.serve',
{'document_root': '/Users/roy/dev/try.django/mysite/static',
'show_indexes': True}),
If I go to http://localhost:8000/stati
I've been playing around with django, building a toy app just to get
the feel of it. I've been going nuts trying to figure out why my
index method has been getting called in all sort of places I didn't
expect. I finally figured it out and thought I would share this with
the group (hopefully to pr
I want my application to be able to access two different mysql
databases (with different credentials, running on two different
servers). One is a large data collection which I'll be accessing read-
only. The other is read-write, and will be the one which manages the
site (account creation, user p
I'm trying to submit a ticket to http://code.djangoproject.com/ and
need to login. I must have created an account long ago because it
says my email address is already in use, but I have long since
forgotten my username and password. I don't see any mechanism to
recover them.
My apologies if this
68 matches
Mail list logo