I've read the
docs: https://docs.djangoproject.com/en/1.3/ref/contrib/messages/
I have the MessageMiddleware in place.
I have the SessionMiddleware in place (before MessageMiddleware)
django.contrib.messages.context_processors.messages in in the context
processors
django.contrib.messages in
> Can you tell us what you goal here is?
The goal is to get my combined list of featured items to a changelist
page. From there, I'll have additional work to do, but step one is
getting it to the page at all.
Another thought is to just chain the querysets together and send 'em
to my own
I'm trying to combine a subset of two models and pass them to an admin
change list:
class FeaturedItemsAdmin(admin.ModelAdmin):
def queryset(self, request):
qs1 = Foo.objects.filter(featured=True)
qs2 = Bar.objects.filter(featured=True)
. do stuff to combine ...
On Nov 7, 4:51 pm, "M. Herold" wrote:
> That last, simple implementation is probably what I'm really looking
> for at this point. My only problem is I'm not sure where that line of
> code should live or where that template is expected (the template
> directory set in my
On Nov 7, 3:50 pm, Nikolas Stevenson-Molnar
wrote:
> Assuming obj is iterable, you can do: {% with
> obj.0.thingobj.get_something as thing %}
>
> ...is that what you mean?
Not exactly, no. In my particular case, it's more of a check to see if
it's available, and if not,
Most times I just use css and percentwidth for simple bar charts.
On Nov 7, 10:23 am, Leotis buchanan
wrote:
> You could also try processing.js
>
>
--
You received this message because you are subscribed to the Google Groups
"Django users" group.
To post to this
I've had per-project views (in the project root), I've had apps
feeding indexes, and I've gone direct to template using template tags
to fill in snippets needed. Most times -- but not always -- the last
approach seems the most flexible and easiest.
On Nov 7, 1:19 pm, Kurtis Mullins
What I'm after is something like {% with firstof obj.thing
obj.get_something as thing %}
Is there any way to do this short of writing my own template tag and
figuring out which exists first? Seems like it would be a fairly
common need.
--
You received this message because you are subscribed to
With debug = False, under what circumstances (if any) should I have
db.reset_queries()? I understand from docs that queries are cleared in
the request cycle, but can anyone give me an example of what sort of
thing would require it being done manually?
--
You received this message because you are
I'm betting it's just sitting in the template as plain HTML.
--
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
I came into Django as a designer. It can be done, just take baby
steps. The more python you learn, the happier you'll be, and the more
productive. But in the mean time, you can do a lot with generic views
and reusable apps that would keep you from having to write much code
at all. I would suggest
And that works, with one
exception: .get_object_for_this_type(pk=object['object_id'])
Getting the objects IS a bit inefficient, but since I only need the
top 10, I can live with it.
On May 27, 12:32 pm, Jason Culverhouse wrote:
> If you were to do something like this:
>
>
I have a "watch" model that lets users keep an eye on various things
through a generic relation:
class Watch(models.Model):
subscriber = models.ForeignKey(User, verbose_name="Subscriber")
content_type = models.ForeignKey(ContentType)
content_object = generic.GenericForeignKey()
Am I correct in understanding that when there is a 500 error and the
user is routed to 500.html, it does not know settings.STATIC_URL or
settings.MEDIA_URL, but 404.html does?
--
You received this message because you are subscribed to the Google Groups
"Django users" group.
To post to this
On Dec 20, 11:26 am, Tom Evans <tevans...@googlemail.com> wrote:
> On Mon, Dec 20, 2010 at 4:52 PM, bax...@gretschpages.com
>
> If I load the page in chrome with its resource tracking debug tab
> open, I can see that several files that are requested receive zero
> sized res
> Just looking at your style.css file, it's got a weird (to my eye) line in it:
>
> src: local('☺'),
> url('/media/fonts/LeagueGothic/League_Gothic-webfont.woff') format('woff'),
>
Comes from fontsquirrel. As I recall, it forces the local load if the
font is available, or passes along
Foolishly posted this late last week, which is a tough time to get
help. Please forgive me for reposting, but I'm at my wit's end here.
What I've got is a very localized, yet apparently completely random
sort of IO error, or something else causing the server to drop out.
You can see an example
',
'utils.lastseen.LastSeen',
'django.middleware.gzip.GZipMiddleware',
'django.contrib.redirects.middleware.RedirectFallbackMiddleware',
'django.middleware.cache.FetchFromCacheMiddleware',
)
On Dec 16, 9:40 am, "bax...@gretschpages.com" <mail.bax...@gmail.com>
wrote:
> This is a weir
This is a weird one. On a handful of topics on my forum, accessing the
topic and/or attempting to add a post or do anything else loses the
network connection. It's only on a handful, and it just started
recently. I have no idea how Django can even do such a thing, but you
can see it here:
I'm finding conflicting info regarding preferred server
configurations.
I'm using Nginx for static, passing off to Apache/mod_wsgi for django
stuff. Currently, wsgi is in daemon, and I'm using the worker MPM.
>From some sources I've seen that is ideal, but I notice in the django
docs that prefork
I'm sure this is simple and I'm just not constructing the URL
properly. Basically, it used to be a drupal site, with the cruddy old
Drupal every url is a querystring setup. What I want is pretty
simple... all of those old URLs resolve to the home page and send a
301 to the spider.
I tried:
I'm having a lot of staff users having login problems. Until today, it
was only IE, but today I saw it happen to a user on FF as well.
The basic flow is like this: They try to login to the admin. It
appears to work. When they click anywhere, it goes back to the admin
login. This repeats several
I came up with a solution using if 'foo' in settings.INSTALLED_APPS:
but it feels pretty hackish. If there's a better way, I'd love to hear
it.
--
You received this message because you are subscribed to the Google Groups
"Django users" group.
To post to this group, send email to
I try to make my apps portable between the various sites/projects that
use them, but I'm running into some problems doing so. I'm hoping
there's some good way to handle this I just don't understand or know
about.
In a nutshell, I've got multiple sites/projects, and I'd like them to
all use the
On Jul 20, 10:30 am, Franklin Einspruch
wrote:
> I can't help but notice that you have import_stuffi() in the cron
> version and import_stuff() in the class. Might that be the problem?
>
Nope, just a typo. That's not it.
--
You received this message because you
I'm trying to write a script that I can run from the command line, as
cron, or as a management command. Command line works fine. Management
command does not. I get an "unknown command" error. Any ideas what I'm
doing wrong here: http://dpaste.com/hold/220122/
--
You received this message because
I have:
DATE_INPUT_FORMATS = (
'%n/%j/%Y', '%n/%j/%y', # '10/25/2006', '10/25/06'
'%n-%j-%Y', '%n-%j-%y', # '10-25-2006', '10-25-06'
'%M %j %Y', '%M %j, %Y', # 'Oct 25 2006', 'Oct 25, 2006'
'%b %j %Y', '%b %j, %Y', # 'oct 25 2006', 'oct 25, 2006'
'%F %j %Y', '%F %j, %Y', #
Still looking for an clue on this. Permissions are simply not there.
On Jun 7, 3:03 pm, "bax...@gretschpages.com" <mail.bax...@gmail.com>
wrote:
> OK, I'm going nuts. For some reason, my user-levelpermissionshave
> disappeared. I can changepermissionsat the group level, but
OK, I'm going nuts. For some reason, my user-level permissions have
disappeared. I can change permissions at the group level, but at the
user level I can only assign groups -- I can no longer just add
individual permissions to that individual user.
Any suggestions on where the functionality may
I have a very simple blog app and am trying to enable moderation on
the entries. I'm following the docs, but nothing seems to be
happening:
The code:
http://dpaste.com/200509/
Which would lead me to entries > 14 days old would be closed for
commenting. Not so. And no matter what I do, all
It's been a while since I messed around on Dreamhost (finding them
utterly incapable of running a django site), but try touching the wsgi
file.
--
You received this message because you are subscribed to the Google Groups
"Django users" group.
To post to this group, send email to
Yup, it was a sql configuration thing. Once that was sorted out,
Django worked exactly as expected, as usual.
--
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 unsubscribe
On May 16, 1:55 pm, Daniel Hilton wrote:
> Can you ping the db machine from the webserver?
> Can you access the db machine from the webserver using a mysql client
> such as Navicat or such like?
I can go to the DB machine via phpmyadmin.
However, when I try to ping
Thanks. In the end I wrote my own. Wasn't that hard, actually. CNPROG
had the same problem the other ones I looked at: more of a site than a
pluggable app. That Django-Voices is definitely interesting, though.
--
You received this message because you are subscribed to the Google Groups
"Django
I know this is something stupid I'm missing, but I'm not getting it.
I'm trying to run my Django from one cloud instance and the DB from
another, to (hopefully) optimize each server for task and balance the
load a bit.
On the DB server, I have mysql installed and have a working database
running
Can anyone give me any suggestions for a relatively simple, pluggable
Q app? I'm looking for something sorta Stack-Overflow-ish, but I'm
OK with handling voting, authentication, search, etc. separately.
What I've found so far (OSQA, Askbot, soclone) are far from pluggable.
I don't want a whole
Try swapping the order of smartypants and widont.
Also, what exactly is standfirst?
--
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 unsubscribe from this group, send email
Even better, don't put them in as an attribute. Separate your JS out
and call the form element by ID (which it already has)
--
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
On Apr 14, 11:08 pm, HiddenWolf wrote:
>
> TemplateSyntaxError at /blog/
>
> Caught an exception while rendering: 'module' object has no attribute
> 'smartyPants'
>
I think you want smartypants, not smartyPants
--
You received this message because you are subscribed to the
Start with the docs and walk through building the example poll app.
>From there, move on to looking at some of the simple pluggable apps,
and/or grab the "practical django projects" book.
On Apr 14, 6:40 am, deikna wrote:
> Hallo , I want to know where I can get simple
Personally, I just set the width of textareas in my CSS and call it a
day.
On Apr 13, 2:35 pm, Ariel wrote:
> if I want to reduce de amount of columns that the
> textarea has, how could I do it ?
--
You received this message because you are subscribed to the Google Groups
ll now.
>
> thank you for sharing your thoughts.
>
> On 13 апр, 00:03, "bax...@gretschpages.com" <mail.bax...@gmail.com>
> wrote:
>
>
>
> > I'm not saying it's the best way, but I would either define my own
> > get_comment_count in my application's m
Without seeing the traceback, this is all just guessing--stabbing in
the dark. But...
a) posting a traceback allows people to actually help not only solve
the problem, but help show how to read the traceback.
b) commenting out template code may have suppressed the problem, but
that still doesn't
Again, without seeing the trace it's hard to say, but it sounds like
your error is happening well before it ever gets to the template,
making the template irrelevant.
On Apr 12, 4:10 pm, Phlip wrote:
> > Uusually the first line in the traceback tells you pretty explicitly
>
Uusually the first line in the traceback tells you pretty explicitly
where the error is. Without the traceback, it's hard to say where your
problem lies.
On Apr 12, 3:25 pm, Phlip wrote:
> Djangoists:
>
> When code below a template throws an error, we get an insanely
>
Probably a dumb question, but can the comments system handle generic
comments? In other words, if I just have a general "comments" page,
can I have comments that aren't attached to any particular object?
--
You received this message because you are subscribed to the Google Groups
"Django
I'm not saying it's the best way, but I would either define my own
get_comment_count in my application's models.py that looped through
the ojbects comments (and their comments) to get an accurate count.
OR
I would store comment_count locally on the object and send a signal
when a comment is
There are several ways you can do it, but probably the most
straightforward is how django does it in the first place:
{% for field in form %}
{% if field.is_hidden %}
{{ field }}
{% else %}
{% if field.errors %}{{ field.errors }}{% endif %}
I would generally recommend against storing html in the database, but
if you're going to, and if you KNOW that it's safe, you have to mark
it safe: {{ obj.stuff|safe }}
On Mar 29, 12:36 pm, gvernold wrote:
> Hi fellow Djangoists
>
> I've got some content with embedded
Looks like it was a pythonpath thing.
--
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 unsubscribe from this group, send email to
django-users+unsubscr...@googlegroups.com.
my setup is like this:
/apps/
/apps/app1/
/apps/app2/
/projects/
/myproject/
I've got it set up that way because multiple projects use multiple
apps. Because of that setup, I use django-admin.py, specifying the
project.
Anyways, from the admin and site side of things, everything looks
Looking at this more, I think I may have more of a logic problem
I think Play can't have any idea of Game roster, because until it's
been saved it has no idea what game it's related to. So maybe what I
need is a way to dynamically fill the player field on Play, after game
has been selected.
I've got a Players model
I've got a Game models with roster, a M2M relationship with players,
to select the players actually playing in that particular game
And I've got a Play model with a foreignkey to Players. What I want is
to limit the list of players to the ones that are actually on the
I think it really depends on the payment system. Most all of them I've
dealt with have some sort of API. Tap into that, and away you go.
Localizable could be interesting, though, just due to currencies and
such. I built one that handled shipping to different areas (US,
Canada, Intl), but all funds
I have some admin-y type functions like "import articles from blog"
that currently are called when a particular URL is visited, and I'd
like to integrate them into the admin. My first thought, since this is
on 1.1, was to use actions, but it appears actions can only work when
applied to selected
On Jan 5, 11:00 am, Zbigniew Braniecki
wrote:
> I'm trying to set up a web project that will use multiple vhosts.
> ...
> Now, there are several apps in this project: - browser, docs, api.
> They share the same data, but they are different "views".
>...
>
> AFAIK
On Dec 29, 3:04 pm, Daniel Roseman wrote:
> I think you're going to need to show us some of the actual code.
Thanks Daniel. I figured it out. In some instances stop time didn't
exist, so of course it wouldn't validate as a datetime. Adding a check
to set empty stop times
I probably shouldn't have posted this so close to Christmas. I'm
hoping someone will see it now and be able to help.
On Dec 21, 10:57 am, "bax...@gretschpages.com" <mail.bax...@gmail.com>
wrote:
> I'm importing data from xml using xmltramp. Among the data are a bunch
> of t
I'm importing data from xml using xmltramp. Among the data are a bunch
of times formatted like so:
2010-05-15 00:00:00
When I import that, I'm getting
Enter a valid date/time in -MM-DD HH:MM[:ss[.uu]] format.
I've tried altering the formatting, but I'm just not getting these
On Dec 11, 1:36 pm, Zeynel wrote:
> I am confused about this because the django documentation here
>
> http://docs.djangoproject.com/en/dev/intro/tutorial01/#activating-models
>
> says that,
>
> >> Now, run syncdb again to create those model tables in your database:
> >>
On Dec 11, 12:21 pm, Zeynel wrote:
> Ok. What else do I need to do after uploading the new models.py with
> new fields to the server and run manage.py syncdb?
>
syncdb will not alter an existing database. You can run it (it won't
hurt) but it won't insert the new fields.
On Dec 11, 11:39 am, Zeynel wrote:
> I just want to add 2 new fields to the model. If I upload the new
> models.py would the app work as before?
Yes, but you'll have to manually adjust your database to have the new
fields.
--
You received this message because you are
> You can do that by creating an
> InlineModelAdmin:http://docs.djangoproject.com/en/dev/ref/contrib/admin/#inlinemodelad...
How, exactly? I tried this, with no luck:
from user_profiles.models import Profile
from django.contrib.auth.admin import UserAdmin
class
Thanks Daniel. I tried with PIL, but it was too slow for me. I think I
have an entirely different solution, though.
--
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
Any suggestions on django/python code to read iptc info from images?
--
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 unsubscribe from this group, send email to
I'm trying to import content from another server via RSS. My problem
is with the images. Parsing the RSS with feedparser, I can get the
image, but from there I've run into trouble. I can save a pointer to
the remote file, but then I can't thumbnail or otherwise work with the
image like a local
Thanks Rob, that makes complete sense. Nothing like a response
straight from the source!
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups
"Django users" group.
To post to this group, send email to
> Are you caching your pages?
Yes, but only for anonymous users
> Are you using Django ORM?
Yes
> Have you added the DebugToolbarMiddleware to your MIDDLEWARE_CLASSES
> in settings.py?
Yes. In settings:
MIDDLEWARE_CLASSES = (
'django.middleware.common.CommonMiddleware',
I finally installed the django debug toolbar, which looks like a very
nice piece of work, but it's not reporting sql queries for me. Every
page: 0 queries, 0 seconds.
Any suggestions on where the problem may lie?
--~--~-~--~~~---~--~~
You received this message
Thanks Karen. It was the path inconsistency. They were uploading, just
not where I was expecting them to be.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups
"Django users" group.
To post to this group, send email to
On Oct 27, 8:39 pm, Karen Tracey <kmtra...@gmail.com> wrote:
> On Tue, Oct 27, 2009 at 5:57 PM, bax...@gretschpages.com <
>
>
>
>
>
> mail.bax...@gmail.com> wrote:
>
> > Not sure what's going on, but my images aren't uploading.
>
>
Not sure what's going on, but my images aren't uploading.
I'm using the built-in dev server.
I'm on OS X.
I've tried a lot of different things for MEDIA_ROOT. The most recent
is:
MEDIA_ROOT = '/Users//Sites/django-media/'
and
MEDIA_URL = '/media/'
For now, while it's just in test, I have
In my server logs, I'm seeing things like this:
[Mon Oct 05 11:00:01 2009] [error] Exception exceptions.TypeError:
"'NoneType' object is not callable" in > ignored
But I'm NOT getting an error report emailed to me for anything like
this. I'm getting emails, but nothing like this, and nothing at
I'm passing through a testcookie function and would like to keep the
request.GET keys
so if the original URL is /testcookie/?foo=1=2
When testcookie works, I want to redirect to the new URL with foo and
bar intact. How?
--~--~-~--~~~---~--~~
You received this
Strange in that it used to work and now doesn't. Unfortunately I only
use it about twice a year, so I'm not sure when it stopped.
Basically, I'm trying to upload a csv and save the fields to the
database:
class SpecialEvent(models.Model):
...
results_csv =
I need my admin login page to be https rather than http.
I'm using SSLRedirect middleware, and it works beautifully every
place else I need an https page. Problem is, on the admin login, I
can't find the URL.
I don't care if the admin as a whole is https. Honestly, I think I'd
prefer it
This is probably more of a python question, but here goes: Can anyone
point me to a method of dynamically attaching a password to a PDF and
protecting the file before it's downloaded?
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the
I'm trying to write a template tag that accesses the user's
request.session. My problem is, I don't know how to get the request.
Googling around, I saw references to including
TEMPLATE_CONTEXT_PROCESSORS in settings, but I'm still not seeing the
request.
Help?
Does anyone know how one would do A/B testing a la Google Website
Optimizer with Django? Some sort of middleware, maybe?
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups
"Django users" group.
To post to this group,
I'm trying to figure out a view for a "featured Foo for ". The
thinking is we'll mark the thing we want featured and which month it
should appear.
So, in the model, I'm thinking featured_for_month with month_choices
being the months and featured for year being something like:
YEAR_CHOICES =
I'm trying to manually create an object (from a signal). My problem is
that the object has a 'sites' M2M field:
class News_item(models.Model):
...
sites = models.ManyToManyField(Site)
...
but when I try to create the object:
news = News_item(
I'm hoping someone can help me get the info I'm trying to get. This is
the structure:
I have Categories
Each Category has one or more subcategory
Articles have a M2M relationship with subcategory so they can turn
up in more than one category as needed.
I'm trying to get one random
What I'm after is documentation for the admin users, similar to the
generated documentation, only less technical. A simple how-to for
people who just want to know how to do things in the admin, but don't
care about views, models and template tags.
Is there an easy way to create/generate such a
I have a random/intermittent user registration problem. I can't figure
out any pattern to it, but it appears to have started when I went to
Django 1.0.
Some users (again, it appears random and intermittent) are not getting
a site user profile created. The auth.user profile is created, and the
Now that I've got my twitter integration sorted out, I'm trying to
figure out how to update the facebook status, too. Twitter was
relatively easy. Can someone point me to the how-to on updating
facebook? The catch: it's the status on a product page, not a profile.
Follow up to my earlier question (http://groups.google.com/group/
django-users/browse_thread/thread/8f41540343634178/c05242e6d3b07d62)
As I mentioned there, I'm trying to use a snippet to send a twitter
update when a news item is created. The news items have a M2M
relationship with sites-- news
In my model, I've got
sites = models.ManyToManyField(Site)
In a signal, I want to check which site(s) that model has been
assigned to, not which site their currently on. I need something like
if instance.sites.id == 1:
do stuff
Of course, that doesn't work. How do I do this?
I know I've seen this before, so I'm hoping someone can help me find
it again.
I need to dynamically filter a select box in the admin, preferably
with jquery (just because I already have it there and it's available)
What I have is a car makes and models with a many to many
relationship. (Some
I'm trying to build a combined feed, and not having much luck. Here's
what I have:
class CombinedFeed(Feed):
title = site.name +" combined feed"
link = "/"
description = "Latest updates from all "+site.name +" feeds"
description_template = 'feeds/combined.html'
def
No question, just a quick RIP for the Rocky Mountain News (http://
www.rockymountainnews.com/)
Its a shame they couldn't keep it going. Their online presence (built
on Django) is/was really nice.
--~--~-~--~~~---~--~~
You received this message because you are
This code used to work, but appears to have stopped working at some
point. I suspect it's either a unicode or escaping thing. I'm trying
to use Amazon web services and return books:
amazonfile = urllib.urlopen("http://webservices.amazon.com/onca/xml?
Perfect. 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
I need a YearField of sorts, where users can select a year (for their
car), and I'm trying to figure out how best to implement it. I'd need
roughly 1901 to present. I know I could just put them all in choices,
but that seems messy and a pain to maintain (even if only once a
year). Better ways?
> so in admin interface i have 3 apps eventsapp, expoapp, and foodapp.
> when i write in terminal
> :~/DJANGOPRJ/myproject/exposite$/ python manage.py shell>>from
> myproject.eventsapp.models import *
>
> Traceback (most recent call last):
> File "", line 1, in ?
> ImportError: No module named
> How do I create a custom widget and what do I have to do to use my
> custom widget in a form?
It's possible I don't understand what you're trying to do, but I think
you just need to call the hook into the id of the textfield. If
multiple, set a class attribute in your form setup and hook onto
> I think what you want to do is:
>
> user_activated.connect(create_site_user)
Thanks. But where, after the send(), or in the signal?
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups
"Django users" group.
To post to
I'm trying to update from my very old version of django-registration
to .7 in hopes of sorting out some registration issues I'm having.
In my old version, I use the profile_callback to create my site user
profile:
from site_users.views import create_site_user
...
url(r'^$',
I think this just started, and may be related to updating to 1.0.2.
Lately I've noticed update_object not updating properly. In
particular, I've noticed boolean fields changing. For example, I'll
have an "approved" field that's True, but when the user update the
info, "approved" is changing to
On Jan 19, 1:42 pm, Andy Mckay wrote:
> If i remember, it's because there's a / at the beginning, you probably
> want a relative path.
OK, where's it picking up the / then?
I've got:
if self.avatar is None:
self.avatar = "img/avatars/default.gif"
No / there.
My SiteUser model allows an avatar upload. If there's not one, it
assigns a default image on save:
def save(self, *args, **kwargs):
...
if self.avatar is None:
self.avatar = "img/avatars/default.gif"
super(SiteUser, self).save(*args, **kwargs)
Pretty straightforward.
1 - 100 of 101 matches
Mail list logo