Hi,
I am looking at Django's performance with respect to modifying large
numbers of objects, each in a unique way that cannot be batched. If I make
a simple change to one of my Django models and save(), and then do the same
thing in sqlalchemy, I notice a performance difference of about 48 time
Damn. Missed that. Thanks.
On Thursday, October 31, 2013 12:56:11 PM UTC-4, Tom Evans wrote:
>
> The Location header must always be a fully qualified URI, according to
> every single version of the HTTP RFC from RFC 1945 onwards.
>
> Cheers
>
> Tom
>
--
You received this message because you
Hi,
If I return an HttpRedirect() with a relative URL in it, I notice that
Django fully qualifies the redirect with a hostname and scheme.
ie.
Location /foo/bar/
goes to
Location https:myserver.mysite.com/foo/bar/
Is there a reason to fully qualify like this? I've found relative URLs much
m
Hi,
I'm using a ModelForm to upload a large file that ends up being
written to a tempfile on disk. When I call form.save(), the file gets
copied to the final filename, but the tempfile is left behind on disk.
I am using a custom handler, which is a TemporaryFileUploadHandler
subclass, but each me
On Nov 1, 1:27 pm, Tom Evans wrote:
> >> Please show the definition of MyForm.
>
> Please do show it.
Sorry, the model was in the previous email, here's the form.
class McdLoadForm(forms.ModelForm):
VERSIONPAT = re.compile(r'^(\d+\.){3}\d+$')
class Meta:
model = McdLoad
Hi,
I'm trying to modify a model instance, specifically the field which is
the model's primary key. When I save, nothing seems to happen.
Everything in cleaned_data is good, but the model is not updated. No
exception is thrown, the field isn't updated, nothing.
All I'm doing is
form = MyForm(req
On Apr 12, 1:44 pm, msoulier wrote:
>
> class Service(models.Model):
> name = models.CharField(max_length=256)
*sigh* I should have had primary_key=True on this. Red Herring, sorry.
Mike
--
You received this message because you are subscribed to the Google Groups
"Django us
ice",
"fields": {
"description": "An FTP service for blah blah blah",
"enabled": false,
"access": "private",
"username": "mcd",
"password&quo
I have a custom field with takes an ipv4/v6 address or an fqdn, or a
list of
same, comma-separated. I'm using it in a form where I then have a
custom
validator for that field.
ie.
class SipTrunkForm(forms.Form):
remote_addr = twcustomfields.SockaddrListField()
remote_port = forms.IntegerF
Hi,
I have a framework on a product that allows new django projects to
make use of
an existing project's code, so new projects can reduce duplication. It
does
this in templates by some trickery with the TEMPLATE_DIRS.
For example, I have a base project here
/var/www/django/base/templates/base.ht
On Apr 3, 6:23 pm, Tomasz Zieliński
wrote:
> I believe that this question was asked on this group a long time ago,
> and the answer was that pre_delete signal was fired *before* actual
> deletion occured,
> but *after* objects were collected for deletion (i.e. after list of
> objects that were to
I have a model A, which has a ForeignKey to model B.
A --> B
When B is deleted I want to save the As that are pointing at B by
repointing them at a different B if possible. To do this I have a
pre_delete signal registered for B models. Unfortunately does doesn't
work.
Django follows the rela
Hi,
I have an existing model that I've used for some time, and just
recently I had to break it up into two related models that share a
great deal, but have some difference, so I used inheritance to create
two subclasses.
I notice that syncdb is smart enough to not create an sql table for
the base
Hi,
So I currently have two models
model Foo(models.Model):
model Bar(models.Model):
foo = models.ForeignKey(Foo)
address = models.IPAddress()
class Meta:
unique_together(('address', 'foo'),)
and this works fine to ensure that the address is unique across each
instance of f
Hi,
I wrote my current Django app in the 0.96 timeframe and have since
upgraded, and now I have these cool signals available. I have some
model code, like overriding the delete() method to prevent deletion of
certain rows in the table, and I'm curious as to whether that can be
done with the pre_sa
On Jan 7, 7:25 am, Tomasz Zieliński
wrote:
> I'm also getting this, so I'm only running my own tests (by passing
> app names to test).
Ok, I suppose that's one solution, but it seems like this test makes
bad assumptions and should first check to see if the sites contrib is
even in the installed a
I can't find anywhere in the django docs where it says that
django.contrib.auth uses django.contrib.sites, but when I run my unit
tests I get this
==
ERROR: test_current_site_in_context_after_login
(django.contrib.auth.tests.views
On May 15, 11:42 am, Spk wrote:
> It seems that everytime I restart the web server, I get a new session
> ID which is why it thinks that there is data to be commited. The
> browser still has the cookie for the previous session ID, and it is
> stored in the database, so why is Django generating a
On May 14, 3:51 pm, msoulier wrote:
> I looked here
>
> http://docs.djangoproject.com/en/dev/topics/http/file-uploads/
>
> and it mentions request.FILES being a dictionary, but the 1.0 porting
> guide here
>
> http://docs.djangoproject.com/en/dev/releases/1.0-porting-g
I looked here
http://docs.djangoproject.com/en/dev/topics/http/file-uploads/
and it mentions request.FILES being a dictionary, but the 1.0 porting
guide here
http://docs.djangoproject.com/en/dev/releases/1.0-porting-guide/
says otherwise.
Was this overlooked? I think the page needs an update.
On Apr 18, 1:42 pm, msoulier wrote:
> cursor.execute("""
> BEGIN;
> UPDATE clients
> SET connected = 'false'
> WHERE connected = 'true'
> AND tugid <> %s;
>
eback.
Traceback (most recent call last):
File "", line 1, in ?
File "/home/msoulier/work/mitel-msl-tug/root/etc/e-smith/web/django/
teleworker/clients/models.py", line 43, in disconnectAll
cursor.execute("""
File "/home/msoulier/work/bin/msl8/li
On Mar 14, 1:35 am, Russell Keith-Magee
wrote:
> It's possible that this is a known bug that has been fixed since v0.96
> was released. Where exactly did metrics object come from? Is is a
> newly created object, or was it obtained as the result of a query?
It was created as a result of a query.
Hi,
Django 0.96 (yes, I know, we'll be at 1.0.2. soon), and I have a model
full of PositiveIntegerField attributes.
One of them is returning a string.
>>> metrics.user_licenses_ca
'315'
>>> type(metrics.user_licenses_ca)
PostgreSQL backend
I thought that the PositiveIntegerField would enforc
On Dec 5, 10:43 pm, Jeffrey Straszheim <[EMAIL PROTECTED]>
wrote:
> I took a quick glance at transaction.py (where the TransactionMiddleware
> class is defined), and it appears you are correct. However, it should
> be pretty easy to roll your own transaction class that skips the
> is_dirty check.
Looking at the transaction middleware that wraps a transaction around
every HTTP request, I've found that it only commits if the transaction
is "dirty" (you change something).
So, if you use this middleware unconditionally, then in view functions
that only read, the transaction will never be comm
On Dec 3, 2:16 pm, msoulier <[EMAIL PROTECTED]> wrote:
> So one process was waiting to acquire an AccessExclusiveLock, and
> there was already an AccessShareLock on it (the clients table).
I've tried Django's transaction middleware, but I'm not sure that a
commit is t
On Nov 18, 7:46 pm, Malcolm Tredinnick <[EMAIL PROTECTED]>
wrote:
> Django doesn't do any explicit table locking, although there are
> transactions involved. However, that shouldn't be affecting this.
So Django is not safe to use in a concurrent environment? Well, it is
if you don't mind two user
Hello,
I have a daemon process running using the Django ORM API to access/
modify tables in PostgreSQL. I just ran into an issue where it looks
like the process is keeping read-locks on the tables that it is
reading, which is preventing a subsequent write lock from granting.
Does the ORM API nor
On Sep 3, 3:44 pm, Rajesh Dhawan <[EMAIL PROTECTED]> wrote:
> Hi Mike,
>
> Assuming that the DB restarts are rare, consider surrounding your
> processing loop with a try..except block. When the exception occurs,
> close the current connection so that the next iteration of your loop
> gets a fresh
I have a long-running process that, to save on code, is using the
Django models used in the web app to access the database.
ie.
os.environ['DJANGO_SETTINGS_MODULE'] = 'myapp.settings'
sys.path.append(os.path.abspath('/path/to/django/project'))
from myapp.subapp.models import MyModel
This work
Hello,
I saw some posts on this but not many useful responses. Apologies if
there's already a known solution.
For a web-based backup, I need to send a large file, basically the
output of a tar process, to the browser. We have legacy Perl code
doing this now but I'd like to use Django. Is there a
On May 15, 2:23 pm, msoulier <[EMAIL PROTECTED]> wrote:
> So, custom SQL in Django can't include a LIKE statement with a %
> unless it's escaped? I'm
> looking in the docs and I can't seem to find anything that mentions
> that.
In fact, I've replaced
I'm trying to inspect the session data in the db.
>>> from django.contrib.sessions.models import Session
>>> q = Session.objects.all()
>>> for s in q:
...print s.get_decoded()
...
Traceback (most recent call last):
File "", line 2, in ?
File "/var/tmp/django-0.96.2-root/usr/lib/python2.3/
On May 15, 2:13 pm, msoulier <[EMAIL PROTECTED]> wrote:
> Actually, it fails in the Django shell, and there only, regardless of
> the db backend.
Oh, scratch that. I just got it to fail consistently in a simple
script that runs only that code.
So, custom SQL in Django can'
On May 14, 10:27 pm, msoulier <[EMAIL PROTECTED]> wrote:
> This seems to work in production with postgreSQL, but on my laptop
> with sqlite I'm seeing an issue.
Actually, it fails in the Django shell, and there only, regardless of
the db backend.
Can anyone th
27;%SIP'
""")
This seems to work in production with postgreSQL, but on my laptop
with sqlite I'm seeing an issue.
Traceback (most recent call last):
File "", line 1, in
File "/home/msoulier/work/mitel-msl-tug/root/etc/e-smith/web/django/
teleworker
On May 8, 2:54 pm, ydjango <[EMAIL PROTECTED]> wrote:
> Is there a application level logging framework/utility in django or
> python that I can use in views to log to file and/or database.
> Something similar to log4j in java.
I'm using the Python standard library's logging module. Works fine.
M
On May 5, 2:01 pm, msoulier <[EMAIL PROTECTED]> wrote:
> Seems like an issue with the built-in web server.
In fact, if I modify handlers/wsgi.py, and print the request object
before it gets to get_response(), suddenly it's fine.
try:
request = WSGIR
Hi,
I'm currently playing with my Django web interface on a windows XP box
with Python 2.5, Django 0.96. Sometimes when I send a redirect in view
code, Firefox says, "The connection was reset while the page was
loading."
Seems like an issue with the built-in web server.
Sample code:
elif r
On May 1, 11:39 am, msoulier <[EMAIL PROTECTED]> wrote:
> So, I narrowed it down to the OR of the resultant querysets.
Ah, it's an inner join, so this likely wouldn't work for any
database.
>>> p.pprint(q3._get_sql_clause())
( [ '"clients_client"
On May 1, 11:16 am, msoulier <[EMAIL PROTECTED]> wrote:
> I have a case where I'm trying to OR several conditions together in a
> query, and I'm including a query against a field in a foreign key
> field.
>
> queryset = queryset.filter(
>
On May 1, 11:20 am, msoulier <[EMAIL PROTECTED]> wrote:
> I looked in the docs and I've failed to find, so I apologize if it's
> freakin' obvious, but how does one concatenate two querysets?
Doh!
http://groups.google.ca/group/django-users/browse_thread/thread/
I looked in the docs and I've failed to find, so I apologize if it's
freakin' obvious, but how does one concatenate two querysets?
ie.
q1 = Client.objects.filter(name__icontains='foo')
q2 = Client.objects.filter(description__icontains='bar')
q3 = q1 + q2 ??
How would I merge these? They behave
I have a case where I'm trying to OR several conditions together in a
query, and I'm including a query against a field in a foreign key
field.
queryset = queryset.filter(
Q(clientid__icontains=filter) |
Q(description__icontains=filter) |
Q(icp__name=fil
On Apr 30, 9:26 pm, Doug Van Horn <[EMAIL PROTECTED]> wrote:
> Seehttp://www.djangoproject.com/documentation/newforms/#accessing-clean-...,
> check the 'Note' section.
Ah, that explains much.
Many thanks.
Mike
--~--~-~--~~~---~--~~
You received this message becau
A coworker of mine created a form with a field called "data".
ie. data = forms.CharField()
This resulted in an exception being thrown when is_valid() was called
on the form:
form error - 'dict' is not callable
The exception occurs at line 180 in
\lib\site-packages\django\newforms\forms.py
If I have a field, for example a CharField named 'name', which must be
unique, what's the best way to ensure uniqueness whether creating a
new entry or editing an existing one?
By default, the form won't know if it is being used to edit or create,
so if you look for duplicates in the db, how woul
On Mar 31, 10:04 pm, Michael <[EMAIL PROTECTED]> wrote:
> Not really a DRY issue moreover there is an easier logic to your code:
Sad that I didn't see that.
Thanks,
Mike
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Group
I find myself doing this a lot in view code
if request.method == 'GET':
form = MyForm(initial=data)
return render_to_response('template.html',
RequestContext(request, {
'foo': foo,
'bar': bar
}))
elif request.method == 'POST':
form = MyForm(request.POST)
On Mar 5, 6:50 am, Malcolm Tredinnick <[EMAIL PROTECTED]>
wrote:
> In the meantime, use the url(...) form for your url patterns and give
> each one that might cause confusion a unique name. That way you can
> refer to them uniquely in the {% url ... %} tag.
Ok, I'll do that when the next Django r
So, my urlconf is
urlpatterns = patterns('teleworker.clients.views',
(r'create/$', 'create'),
(r'modify/(?P\d+)/$', 'modify'),
(r'delete/(?P\d+)/$', 'delete'),
(r'page/(?P\d+)/(?P\w+)/(?P\w+)/$',
'list'),
(r'page/(?P\d+)/$', 'list'),
(r'^$', 'list'),
)
The list function i
On Feb 21, 10:57 pm, "Russell Keith-Magee" <[EMAIL PROTECTED]>
wrote:
> I've logged this as #6643. I'm hoping to have some time tonight to
> look at a few outstanding fixture tickets; I'll add this one to the
> list.
Thanks, you guys rock.
Mike
--~--~-~--~~~---~--~---
Hi,
I'm loading a fixture with 2500 objects in it into postgres 7.4.
For some reason, loaddata is looking in a lot of additional places
than the file I'm handing it.
[EMAIL PROTECTED] teleworker]# PYTHONPATH=.. python manage.py
loaddata /root/clients.json
Loading '/root/clients.json' fixtures..
On Feb 16, 8:37 pm, Graham Dumpleton <[EMAIL PROTECTED]>
wrote:
> Are you trying to use mod_python 2.7.X on Apache 1.3 by chance?
Indeed I am.
> From memory ap_auth_type attribute may only be in Apache 2.X and thus
> you need to be using mod_python 3.X, preferably 3.3.1, on Apache 2.X.
Ok, than
On Feb 16, 3:41 pm, Malcolm Tredinnick <[EMAIL PROTECTED]>
wrote:
> Instead, you need to use 127.0.0.1 to force the connection to go via
> TCP/IP. I'm pretty sure, without having tested it, that Django will be
> fine with that (setting the HOST string to an IP address). We just pass
> that informa
I'm trying to move an existing site to another server, and I'm getting
this error when I access the new site.
Mod_python error: "PythonHandler django.core.handlers.modpython"
Traceback (most recent call last):
File "/usr/local/python-2.5/lib/python2.5/site-packages/mod_python/
apache.py", lin
On Feb 11, 8:02 pm, "Russell Keith-Magee" <[EMAIL PROTECTED]>
wrote:
> This is correct - SQL for data fixtures won't be dumped. The error
> message is a little misleading in this respect, as it refers to
> initial data, not custom SQL. I've clarified the text in [7106].
>
> As for the --interactiv
I have a site where I need to use the mysql tcp port of 3306 instead
of the unix domain socket, to talk to mysql. So, I did this in my
settings.py
DATABASE_HOST = 'localhost'
DATABASE_PORT = 3306
Unfortunately, it seems to be ignored.
_mysql_exceptions.OperationalError: (2002, "Can't connect to
syncdb [--verbosity] [--interactive]
Create the database tables for all apps in INSTALLED_APPS whose
tables haven't already been created.
python manage.py syncdb --interactive
manage.py: error: no such option: --interactive
sqlall [appname ...]
Prints the CREATE TABLE, initial-da
On Jan 27, 12:46 am, "James Bennett" <[EMAIL PROTECTED]> wrote:
> You can assign a numeric ID of a TugInstance object to 'instance_id'
> on a Client object.
>
> You can assign an actual honest-to-goodness TugInstance object to
> 'instance' on a Client object.
Ah, that helps. The docs don't seem t
So, I have a Client model that includes an instance field
instance = models.ForeignKey(TugInstance)
When my form is submitted, I am assigning
client.instance = form.clean_data['instance_id']
But this isn't working. I get an error on save() that 'instance_id'
cannot be NULL.
If I change my cod
On Dec 2, 8:27 pm, Darryl Ross <[EMAIL PROTECTED]> wrote:
> I've done this is CSS files before, so it should work just fine. Just
> make sure you set the correct Content-Type header in your JS view.
FTR, this works fine. I couldn't use render_to_response() as I had to
supply the mimetype, but oth
I'm trying to write db initialization code for an existing db
framework on a product that I work on. To do this I'm "asking" django
to show SQL that it would use to create its db, so I can copy it into
the initialization code.
I can't though, as I haven't created the db yet, and for some reason
i
Hi,
I'm adding some Ajax effects to my Django site, and there are some
things in the javascript that I'd like to template. Currently my
javascript is inline in my index.html file, so I can template things
like
var debug = {{ debug }};
var refreshtime = {{ refreshtime }};
That way, settings in m
I am using Django stable (0.96).
When I use form_for_model on a model that includes CharFields that
have choices attributes, the resulting form field is not a ChoiceField
as specified in the documentation. Is this simply a bug in 0.96?
Also, if I wish to return a different field type, not based
On Sep 17, 11:00 pm, "Ben Ford" <[EMAIL PROTECTED]> wrote:
> Hi Mike,
> There is a branch that supports multiple databases in the repository. It's
> quite out of date in the SVN repo but Koen put in some stirling work over
> the period of the sprint and produced a patch against trunk at around r61
I was hoping to use Django in a web management UI for a server that I
support, where new UIs are added as new applications are installed.
Due to this plugin requirement, I had planned to model that with one
large Django project, where each new plugin was a Django application.
Unfortunately it wou
68 matches
Mail list logo