Copying things from request.META to the env parameter of Popen allows
me to get the cgi off the ground. Now I have the problem that the cgi
is generating a cookie and content type, which django returns to the
browser as page content.
Is there a way to pass it back transparently? Or, failing that,
I have a model with a "name" field that is the primary key. When
serializing, this field gets serialized as "pk" instead of "name".
Is there an easy way to get django to serialize with the actual field
name instead of changing it to pk?
--
You received this message because you are subscribed to
mysql generates an informational warning when running "drop table if
exists " if the table doesn't exist. Django then throws an
error and aborts.
Is there a good way to avoid this?
b.c.
--
You received this message because you are subscribed to the Google Groups
"Django users" group.
To post t
I have a url spec like so:
(r'^foo/$', 'blah')
I just noted from our server logs that if someone mistakenly types two
slashes ('foo//'), the page
gets served, but all of the relative links are broken. It's really
confusing. I believe it should be redirecting or 404ing instead.
I note that foo/bar
I don't think so. It's not issuing a redirect. It's just serving the
view, even though the url spec doesn't match.
On Thu, Dec 1, 2011 at 2:42 PM, creecode wrote:
> Hello Brain,
>
> Could it be you are seeing the results of the APPEND_SLASH setting <
> https://docs.djangoproject.com/en/1.3/ref/se
Is there an easy way to use a ModelChoiceField with multiple databases?
The only thing I've seen that looks promising is overriding the form
__init__ and setting the queryset for the field. Seems kinda clunky.
--
You received this message because you are subscribed to the Google Groups
"Django
Is overwriting settings.DEBUG the recommended way to get
connections[db].queries to work during a unit test?
--
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
I have two models. The second one has a ManyToMany to the first. Both
are managed. If I drop both tables and run syncdb, only the two model
tables are created. There's no join table. syncdb doesn't report any
errors.
"validate" shows 0 errors. Any ideas what the problem could be, or how
to debug i
but
I don't have control of that on the generated model.
On Wed, Jan 4, 2012 at 10:57 AM, Brian Craft wrote:
> I have two models. The second one has a ManyToMany to the first. Both
> are managed. If I drop both tables and run syncdb, only the two model
> tables are created. Th
Looks like a m2m class can be identified by the ._meta.auto_created
attribute, which also holds the class with the m2m field. So the
router can check for attributes on that class.
On Wed, Jan 4, 2012 at 11:49 AM, Brian Craft wrote:
> I strongly suspect the problem I'm having has to
I'm getting duplicate entry integrity errors when saving an object, with
transaction middleware enabled in django 1.3.
I thought the point of the middleware was to rollback transaction errors
and retry the view. Why would I be getting this error?
The db is mysql. The save code looks like this:
t
I need to create objects with version tracking, a bit like wiki
content. Anyone done this in django?
I could create a model with a content field and a version field. But
I'm not sure how to query (for example) all the latest versions of a
set of objects. I'm sure there's a raw sql method via joins
A form with a CharField seems to end up with a zero-length string in
the cleaned_data if the field is not in the form data. Is there any
good way to avoid this?
--
You received this message because you are subscribed to the Google Groups
"Django users" group.
To post to this group, send email to
I would like unit tests that do file manipulations to run with a
different storage "location", so they're not manipulating real app
files. Is there a good way to do this? Is there a way to override
model field initializers, so I can instance a model, passing in the
'storage' parameter for an ImageF
I have a model with an imagefield, and some fields that are computed
from the image. I'm trying to override the "save" method to fill in
the other fields.
When I test this in the admin, there are two problems: first, the path
(mymodel.image.path) doesn't honor the upload_to setting on the field.
I
solved this by moving it to the model clean() method, and using
imagefield.file.open() and imagefield.file.read() to get the data for
computing the other fields.
On Wed, May 11, 2011 at 1:28 PM, Brian Craft wrote:
> I have a model with an imagefield, and some fields that are computed
> fr
Is there a good way to add new users to a default group when they are
created (e.g. via django-registration)? I just tried binding the
post_save signal for User, and adding the group in the signal handler
(if "created" is true). However, I haven't found a good place (file)
to put the connect() call
project __init__.py, but that works inconsistently, apparently
because django isn't fully initialized when the project __init__.py is
loaded.
On Tue, May 17, 2011 at 11:07 AM, Brian Craft wrote:
> Is there a good way to add new users to a default group when they are
> created (e.g. vi
Is there an easy way to get checkboxes for groups in the User admin,
rather than a multiselect?
--
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, s
I'm testing the patch for ticket 2131
(http://code.djangoproject.com/ticket/2131) on 1.2.3. I'm getting back
a 500 (internal server error) sometime after returning the
HttpResponseSendFile(), with nothing in the apache error log.
Any suggestions on how to debug this?
--
You received this message
I'm interested in using RewriteMap (from mod_rewrite) to check for a
django user session. That is, RewriteMap would invoke some script
which would return session info, which could be used by mod_rewrite to
allow or deny access. Basically, this would require writing a
standalone python script that r
Are there docs somewhere for the Group methods? E.g., I discovered
through extensive googling that I can call user.groups.all(), but I
can't find docs of an "all()" method, or any other method for Groups.
If there aren't docs, how does one discover the methods?
--
You received this message becaus
I'm trying to implement a stand-alone python script to check a session
cookie for group authorization. I cribbed from the auth and session
middleware, so I could take the sessionid from the cookie, look up the
session, look up the user, and get the list of groups.
This all basically works, except
Digging into the problem I'm having with a standalone django script,
the problem seems to be that django doesn't see updates to the
database unless it writes to the database.
In the following lines,
ss = engine.SessionStore(session_id)
session=ss.load()
If session_id "abcd" has been added t
n?
On Fri, Jan 28, 2011 at 6:51 PM, Karen Tracey wrote:
> On Fri, Jan 28, 2011 at 9:45 PM, Brian Craft
> wrote:
>>
>> Digging into the problem I'm having with a standalone django script,
>> the problem seems to be that django doesn't see updates to the
>>
Suppose the project is /var/www/django/project. Following the django
with wsgi docs, you would add /var/www/django to the path, and
DJANGO_SETTINGS_MODULE would be project.settings.
However, in that case, the path scheme described in the tutorial
doesn't work, e.g. setting up admin.py for Polls as
explicitly commit after every select.
On Fri, Jan 28, 2011 at 6:51 PM, Karen Tracey wrote:
> On Fri, Jan 28, 2011 at 9:45 PM, Brian Craft
> wrote:
>>
>> Digging into the problem I'm having with a standalone django script,
>> the problem seems to be that djan
I notice that the csrf token is not secure, i.e. the Set-Cookie is
constructed w/o the "secure" option, so the browser will send it
in-the-clear. It's trivial, then, for a 3rd party to discover the csrf
token.
Am I missing something?
--
You received this message because you are subscribed to the
in an insecure cookie, it can be sniffed. Then
I don't understand what prevents the attacker from constructing a
valid form.
On Wed, Feb 9, 2011 at 11:36 AM, Ian Clelland wrote:
> On Wed, Feb 9, 2011 at 11:23 AM, Brian Craft wrote:
>> I notice that the csrf token is not secure, i.e
types the url and hits port 80, the MITM can
create an https connection to the target site, and return it via http.
I'm not certain there's a csrf attack here, but I suspect there is.
On Wed, Feb 9, 2011 at 11:28 PM, Ian Clelland wrote:
> On Wed, Feb 9, 2011 at 11:51 AM, Brian
I've found any number of threads on using email as username in django,
but none that are both current and conclusive. "Just do ", followed
by "But that breaks [the forms, the templates, the auth site, the
registration, the db schema]" etc., where is something like "use
email in the User username c
On Fri, Mar 4, 2011 at 1:34 PM, Shawn Milochik wrote:
> What's wrong with writing your own auth backend? It's two piddly functions:
>
> http://dpaste.com/hold/473373/
>
I think this has already been answered, in the comments here:
http://djangosnippets.org/snippets/74/
and in the "motivation" s
On Tue, Mar 8, 2011 at 12:53 PM, william ratcliff
wrote:
> If you look through the code in the django admin, then the limit is set in
> the database schema.
I've read elsewhere that it's also in all the auth form validations,
so you have to subclass all of them. I haven't actually investigated
th
I have a script that sits in a loop, doing occasional queries, something like
while 1:
wait.for.some.event()
object=get.some.django.db.object()
do.something.with(object)
transaction.commit_unless_managed()
The last line is required so the script will see updates to the
database from other
When a long-running script loses the db connection, I get this exception:
_mysql_exceptions.OperationalError
Is there any way to trap this in a database-agnostic way? Or must I
hard-code it to mysql?
--
You received this message because you are subscribed to the Google Groups
"Django users" g
In an ajax-based site, where the page is static, and makes ajax calls
after loading, how would one get a csrf cookie? There aren't any
templates associated with the views (they just return json strings).
Setting of the cookie seems to be a side effect of serving forms in
django, but the client does
Yeah, I'm using that technique. It works fine once you have the
cookie. My question was about how to get the cookie, which is not
described well in the documentation.
Manually calling get_token() in the view for the first ajax GET seems
to be working. After that I can POST to other views.
On Sat,
It's in a cookie once you coerce django into sending the cookie to the
browser. This is less automatic for ajax apps, because django isn't
serving the forms (which is when it usually sends the csrf cookie).
On Mon, Mar 21, 2011 at 9:49 AM, Matt Robenolt
wrote:
> To get the token? It's stored in
No, it's not. It's a static file.
On Mon, Mar 21, 2011 at 10:23 AM, Matt Robenolt
wrote:
> Is your main view being rendered by Django or something else? If so, you'll
> have access to the cookie.
>
> On Mar 21, 2011, at 1:09 PM, Brian Craft wrote:
>
>> It&
39 matches
Mail list logo