Does anyone know why create_permissions doesn't work (or throw any
errors) when used in a view, but works when I run the same code in the
manage.py shell?
## views.py ###
from django.db.models import get_app
from django.contrib.auth.management import create_permissions
from django.http imp
Makes sense. I actually ended up using your example and it worked well
as far as I can tell. And you actually explained the importing too,
which is where I messed up previously.
Also, I made the mistake of putting it in a file that was already
importing a bunch of other things, so I got wrapped up
I tried akaariai's method, but I may have done the importing wrong. It
seemed to make apache struggle mightily to the point where it was
unusable for some reason.
Doug, I don't see how the LazyFetch you wrote is much different than
what akaariai shared? Can you explain to me what the difference is
27;)
>
>
>
>
>
>
>
> On Wed, Feb 8, 2012 at 3:29 PM, bfrederi wrote:
> > I'm already using memcached over http so I can have multiple memcached
> > instances. But there isn't any way to set priority or which cache the
> > item goes to or is pulled from.
hing the data using Django's caching framework and either
> the local memory or memcached backend. To update the cache, write a
> management command that runs periodically as a cron job. (If you find
> yourself needing more sophisticated background task management, check out
> Celery
So would I put that class in my settings.py? Where would I put that
class to make sure that the data is frequently retrieved from local
memory?
On Feb 8, 4:47 pm, akaariai wrote:
> On Feb 9, 12:14 am, bfrederi wrote:
>
> > I have some data that I retrieve using urllib and the
I have some data that I retrieve using urllib and then cache on a
different server that I frequently use through my site. Since it gets
used so frequently, I was wondering why it might be a good/bad idea to
make the urllib request in the settings.py. It's data that gets
changed infrequently, but sh
I've noticed that occasionally XML files that we create and server
through Django get a character appended onto the file when Django
caching is turned on. If I restart memcached on the remote server, the
appended character (in the last case I saw, it was a "W") disappears
and the XML file appears n
Flatpages view:
https://code.djangoproject.com/browser/django/tags/releases/1.3/django/contrib/flatpages/views.py#L20
--
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 unsubsc
I discovered it was because flatpages automatically adds an append slash,
and the custom middleware I wrote has to come after the flatpages
middleware. When append slash is added, the query is stripped from the url,
but I needed the query to be retained.
So example.com/thing.php?q=test would en
I wrote a middleware to redirect legacy urls when they 404. I noticed
a problem with urls that have .extension in the path, such as:
example.com/thing.php?q=test When I check the response.status_code in
my middleware, it gives a 302 instead of a 404. But when I use
django's resolve() on request.pat
I've tried a couple of different methods for streaming a large csv
file (it takes a few minutes to download entirely). The most recent
method I pulled from here:
http://stackoverflow.com/questions/2922874/how-to-stream-an-httpresponse-with-django
I turned off the GZipMiddleware and added the
@cond
.
On Aug 23, 12:17 am, bfrederi wrote:
> When I attempt to run a normal cleanup, the cleanup eventually loses
> connection to the database and dies. I think I am going to have to
> take the manual approach.
>
> One thing that I wanted to point out is that I think you meant the SQL
< '2010-01-01 1:23:45';
It should be less than, I believe. But that is very helpful, and I
will need to use that to clean up the session table manually.
On Aug 20, 8:44 pm, Russell Keith-Magee
wrote:
> On Fri, Aug 20, 2010 at 11:51 PM, bfrederi wrote:
> > I just wanted to
I just wanted to know if anyone had an opinion or whether running a
django-admin.py cleanup on 40 million session rows might slow down or
lock up the database. I would like to do this cleanup ASAP, but I was
concerned it might cause some issues.
--
You received this message because you are subscr
This thread really helped:
http://groups.google.com/group/django-users/browse_thread/thread/974c36053d40a38/00f7ff4760aa7d6f
--
You received this message because you are subscribed to the Google Groups
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To
ects that live under accession
accession_admin = admin.AdminSite(name="tfc")
accession_admin.register(Accession, AccessionAdmin)
accession_admin.register(Donor, DonorAdmin)
Then in urls.py:
url(r'^tfc/admin/', include(accession_admin.urls)),
url(r'^admin/', include(ma
I am having some problems with the admin foreign key fields. The "+"
link leads to incorrect urls for adding new foreign keys. This happens
in nearly all instances in admin, such as the group foreign key in the
Django User model. Here is what the + link provides:
"http://example1.com/admin/auth/use
Perfect! Thanks for the advice. I should have been using pdb with the
devserver a long time ago.
I used this screencast as a tutorial:
http://ericholscher.com/blog/2008/aug/31/using-pdb-python-debugger-django-debugging-series-/
As I stepped through my request, I realized that the Referer wasn't
g
I'm attempting to re-route user posts from one django instance to
another. I'm doing this by receiving a user's post request, and then
sending the post to another django instance as a post request (sorry
if this is confusing).
I'm having trouble making a post request to a django form using
urllib2
I happened to be stopping by to post my own question, and I don't know
if this is the answer or not, but have you tried adding the argument
blank=True to your model field?
http://docs.djangoproject.com/en/dev/ref/models/fields/#blank
--
You received this message because you are subscribed to the
orrect content length to the response (calculate:
original size + prepended data size). Otherwise you won't be able to
stream the data properly.
On Mar 16, 1:48 pm, bfrederi wrote:
> *I know that I should serve static files using a static file server
> that was built for doing such,
*I know that I should serve static files using a static file server
that was built for doing such, but save me the lecture and indulge me
on this please*
I am serving large video files (180+MB) through HttpResponse in
Django, and returning the file iteratively using Django's FileWrapper:
http://co
I got advice from someone in the IRC channel to do this:
from django.contrib.sites.models import Site
def __unicode__(self):
return self.name
Site.__unicode__ = __unicode__
And it worked.
On Dec 9, 6:02 pm, bfrederi wrote:
> In one of my models, I have a foreign key to Django
In one of my models, I have a foreign key to Django's Site model. When
I view my model in admin, it displays the Site entries by their domain
(in the __unicode__ method). Is there any way to display the name of
the Site instead of the domain in admin?
--
You received this message because you are
Well, I started to write a new login for auth, and you are right, it
is WAY more trouble than it's worth. I don't think I need anything as
big as django-ldap-groups (which is nice), but I am just going to save
the users into django's auth user table and just separate out the ldap
users in admin I g
I'm not looking to avoid effort. I just don't want a bunch of extra
users cluttering up my system if I don't need to. I have no desire for
them to exist in my system for any reason. I want to keep the number
of django users limited in my system so it is easier to manage them in
admin.
Thanks for t
I am writing my own custom authentication for AD/ldap and I am trying
to authenticate the user without saving the user in the Django User
table. I also don't want the user to have to log in every time they
want to view something. Is there any way to not save the user in the
Django User table and ke
Thanks for the help. I accomplished my task. All of the links I posted
were exactly what it took to make it work.
-Brandon
On Aug 12, 1:31 pm, bfrederi wrote:
> I found
> this:http://code.djangoproject.com/browser/django/trunk/django/contrib/adm...
> So it looks like it will al
I found this:
http://code.djangoproject.com/browser/django/trunk/django/contrib/admin/options.py#L192
So it looks like it will allow me to override the template here:
http://code.djangoproject.com/browser/django/trunk/django/contrib/admin/options.py#L586
So if I can override this effectively:
ht
hanks,
Brandon
On Aug 11, 11:13 pm, Karen Tracey wrote:
> On Tue, Aug 11, 2009 at 11:57 PM, Russell Keith-Magee <
>
>
>
> freakboy3...@gmail.com> wrote:
>
> > On Wed, Aug 12, 2009 at 10:24 AM, Karen Tracey wrote:
> > > On Tue, Aug 11, 2009 at 4:14 PM, bfrederi
I was browsing contrib/admin templates for the "Change User" template
that allows you to change the user's permissions and such. I can't
seem to find it though. Can anyone point me in the right direction?
--~--~-~--~~~---~--~~
You received this message because you a
Yes. I completely missed that ticket, but I had switched to importing
markdown normally instead of through Django, and it solved my
problems.
But I noticed on Ubuntu that the repository version of python-markdown
is still 1.6. So I will switch to a newer version of Markdown. Thank
you both for yo
Sorry, didn't mean to post so many replies. A combination of an
annoying KVM switch and user error.
On Jun 1, 3:19 pm, bfrederi wrote:
> I'm getting this:
>
> Traceback (most recent call last):
> File "/home/django-code/aubrey_explore/tests.py", line 18, in
&
sition
292: ordinal not in range(128)
On Jun 1, 1:49 pm, Karen Tracey wrote:
> On Mon, Jun 1, 2009 at 2:26 PM, bfrederi wrote:
>
> > I am having problems using the
> > django.contrib.markup.templatetags.markup.markdown function with
> > special characters (diacritics and such)
sition
292: ordinal not in range(128)
On Jun 1, 1:49 pm, Karen Tracey wrote:
> On Mon, Jun 1, 2009 at 2:26 PM, bfrederi wrote:
>
> > I am having problems using the
> > django.contrib.markup.templatetags.markup.markdown function with
> > special characters (diacritics and such)
sition
292: ordinal not in range(128)
On Jun 1, 1:49 pm, Karen Tracey wrote:
> On Mon, Jun 1, 2009 at 2:26 PM, bfrederi wrote:
>
> > I am having problems using the
> > django.contrib.markup.templatetags.markup.markdown function with
> > special characters (diacritics and such)
I am having problems using the
django.contrib.markup.templatetags.markup.markdown function with
special characters (diacritics and such).
I am using markdown in my model and creating a function that returns
markdown from a model field. I even went as far as to override the
save method for my mode
7;Pears'}
> > >>> good = dict()
> > >>> for k,v in bad.items():
> > >>> good[k.replace('-','_')] = v
> > >>> good
>
> > {'var_1': 'Apples', 'var_2': 'Pears'}
>
&g
I have a dictionary of dictionaries that I want to use in a template.
Unfortunately some of the keys are hyphenated (I can't change it), so
when I try to call them in the template using {{ dictionary.key-
name }} it doesn't work:
Could not parse the remainder: '-qualifiers' from
'display.vocabula
I have a general question about creating a response in Django.
If I am creating a response using the return
django.shortcuts.render_to_response function:
return render_to_response(
'template_name.html',
{'huge_dictionary_of_data': huge_dictionary_of_data,},
RequestContext(request, {}
Nevermind, I think I found my answer.
in the model._meta attribute, there is an attribute called fields
(model._meta.fields) that is a list of the fields in the model, in the
order in which you defined them.
On Dec 15, 10:24 am, bfrederi wrote:
> If I've defined a model like so:
&
If I've defined a model like so:
class comment(models.Model):
name = models.CharField(max_length=25)
place = models.CharField(max_length=100, blank=True)
comment = models.TextField()
How do I get the order I defined the model fields in, once I have the
model object.
For instance:
m
It turns out I am having the same issue. I just added on batchadmin
and I can't seem to override templates across the entire project (I
wanted to add some JQuery to filters.html). How did you solve your
problem?
On Nov 3, 5:02 am, Lars Stavholm <[EMAIL PROTECTED]> wrote:
> Lars Stavholm wrote:
>
My apologies, those tickets are exactly what I was looking for.
Thanks!
http://code.djangoproject.com/ticket/9180
http://code.djangoproject.com/ticket/5589
On Nov 20, 2:40 pm, bfrederi <[EMAIL PROTECTED]> wrote:
> I don't think those ticket numbers are correct. Those are dealin
I don't think those ticket numbers are correct. Those are dealing with
forms... not caching.
On Nov 20, 2:13 pm, "Ramiro Morales" <[EMAIL PROTECTED]> wrote:
> On Thu, Nov 20, 2008 at 6:00 PM, bfrederi <[EMAIL PROTECTED]> wrote:
>
> > I am trying to cache
I am trying to cache a small thumbnail image. The code is a bit
extensive, but the part this is breaking is that I am opening the
image file, then this:
cache.set('thumbnail_file', image_file.read())
when I go to retrieve the image with:
cache.get('thumbnail_file')
I get this traceback:
Trace
@Adam Fast
I think you are right. I'm not at home, so I can't check for sure, but
I'm almost positive I completely forgot to add 'appengine_django' to
my INSTALLED_APPS. Thank you.
@free won
I started with app-engine-patch actually, because it was the first
patch/helper I came across. But then I
Just in case it's any help, this is the tutorial I am using:
http://code.google.com/appengine/articles/appengine_helper_for_django.html
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups
"Django users" group.
To post to
I am trying to get django1.0 running with the google-app-engine SDK. I
am using the "Google App Engine Helper for Django" and trying to
follow that setup, but I can't seem to get it working. I did a
checkout of the helper (svn checkout
http://google-app-engine-django.googlecode.com/svn/trunk/),
a
I have a dict that looks similar to this:
{'com': 'communication', 'tel': 'telephone', 'cel': 'cellphone',
'fax': 'fax machine',}
And I want to sort it by value, and render it in a template. I was
able to do it, but in a very hacked way. Can anyone show me a better
way to do it than my solution.
I am curious as to what other Django based projects are named
something to do with other jazz people (such as Django, Ellington, and
Satchmo)? I think it's a cool convention, but those are the only 3 I
can think of when I am trying to tell people about it.
Thanks,
Brandon
--~--~-~--~~
gt;
> Cheers,
> Mike
>
> On Mar 28, 1:16 pm, bfrederi <[EMAIL PROTECTED]> wrote:
>
> > Mike,
>
> > I'm not exactly sure how to do a read and get the file to be cached in
> > memory with the middleware. If you look at the links I posted to my
> > code
giving Django conflicting requests since you're
> saying "Don't load the file into memory, load it lazily" while also
> saying "load the entire response into the cache".
>
> Regards,
> Mike
>
> 1:http://code.djangoproject.com/browser/djang
che".
>
> Regards,
> Mike
>
> 1:http://code.djangoproject.com/browser/django/trunk/django/middleware/...
> 2:http://www.djangoproject.com/documentation/cache/#controlling-cache-u...
>
> On Mar 27, 6:13 pm, bfrederi <[EMAIL PROTECTED]> wrote:
>
> > I appreciate the he
I appreciate the help Rajesh,
I haven't added any special settings for the cachemiddleware, I just
placed 'django.middleware.cache.CacheMiddleware' in my middleware
classes and that's it. As far as the low-level caching that I have
written into my code using the "from django.core.cache import cac
When I enable CacheMiddleware for site caching (using memcached as my
cache backend), I notice that if the page requires opening a file on
the file system or over http, that opening the file won't work, and
causes problems, the most typical being "ValueError: I/O operation on
closed file".
I also
configs are nearly identical, do a diff and see what *is* the
> > difference between the two? Are the two running the same django versions?
>
> > bfrederi wrote:
> > > I am using flatpages on a production box, and whenever I don't set
> > > DEBUG to True in the se
al, do a diff and see what *is* the
> > difference between the two? Are the two running the same django versions?
>
> > bfrederi wrote:
> > > I am using flatpages on a production box, and whenever I don't set
> > > DEBUG to True in the settings.py file, the
I am using flatpages on a production box, and whenever I don't set
DEBUG to True in the settings.py file, the middleware won't redirect
to my flatpages for some reason. It gives me a 'TemplateDoesNotExist:
404.html' error message.
It works perfectly fine on another box, and the setup for both box
I am working with using memcached with Django, and a problem came up.
I have memcached running, and using the
django.middleware.cache.CacheMiddleware to cache my entire site seems
to be working. But when I try to use the low-level api Django way for
caching (
http://www.djangoproject.com/documen
Sweet, thanks!
Do you know how to use the cmemcache library instead of the python-
memcached library to do what effbot did? Because I'm pretty sure you
can't have both modules, because the Django documentation says to pick
ONE. And since they emphasized it, I think they mean it. Also it seems
tha
> 'memcached', and also your app is named 'memcached'. Maybe try
> > renaming your app to 'memcached_status' or something and see if that
> > works better.
>
> > Thanks,
> > Eric Florenzano
>
> > On Jan 18, 12:38 pm, bfrederi <[EMAIL PROTE
really throw a
newby like me off.
So anyway, nevermind on the previous question :)
On Jan 18, 12:38 pm, bfrederi <[EMAIL PROTECTED]> wrote:
> Great, that looks like it will serve its purpose. I am trying to get
> it to work, and I am messing it up somehow. I made it into an
:
Tried memcached_status in module memcached. Error was: 'module' object
has no attribute 'memcached_status'
Hopefully someone can spot my problem, thanks :)
On Jan 18, 11:40 am, Alex Koshelev <[EMAIL PROTECTED]> wrote:
> http://effbot.org/zone/django-memcached-view.htm
&
I am using memcached as my backend for cache, but I am not sure how to
check the statistics on memcached, to see what it is actually doing. I
can tell it is working, but I want to see some actual stats on how
well it is working. I've heard there is a "stat" command for
memcached, and I tried doing
#x27;ve done it
sooner.
On Nov 19, 4:22 pm, Graham Dumpleton <[EMAIL PROTECTED]>
wrote:
> On Nov 20, 8:09 am, bfrederi <[EMAIL PROTECTED]> wrote:
>
> > We figured it out by looking in themod_pythonhandler and themod_pythondocs.
> > What we were looking
We figured it out by looking in the mod_python handler and the
mod_python docs. What we were looking for was in request._req actually
(through the mod_python handler), so thanks for that tip. It was the
request._req.unparsed_uri attribute. It gives you the unadulterated
originally requested url. J
I am currently working with a form persistent identifiers. As part of
the persistent system, users can add '?' to the end of the urls to
receive a data-only view of the digital object they are trying to link
to via the persistent identifier, such as this:
Normal view: http://ark.cdlib.org/ark:/130
69 matches
Mail list logo