Messages framework not including tags

2012-06-21 Thread bax...@gretschpages.com
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 in installed apps.

Template has the standard messages code:

{% if messages %}

{% for message in messages %}
{{ message 
}}
{% endfor %}

{% endif %}


I'm getting the message(s), but there is no tag associated. What am I missing?

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/django-users/-/9pd8I94-CYMJ.
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/group/django-users?hl=en.



Re: Custom admin changelist queryset

2011-11-18 Thread bax...@gretschpages.com
> 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 template. It would look like part of the admin, but not
actually be part of the admin. Problem there, of course, is that if I
wanted actions, list display, or any other admin-y goodness, I'd be
out of luck, I think.


> > 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 ...
> >      return combined
>
> > I can return qs1 or qs2 to the admin, no problem. But I can't put them
> > together in a way the admin will accept.
>
> > First thing I tried was a simple itertools.chain. I've also tried
> > building a custom queryset (http://djangosnippets.org/snippets/1933/)
> > and subclassing queryset. At best, I get nothing, but most times I
> > get:
>
> > "Database error
> > Something's wrong with your database installation. Make sure the
> > appropriate database tables have been created, and make sure the
> > database is readable by the appropriate user."
>
> > Which I've tracked down to a IncorrectLookupParameters exception in
> > contrib.admin.options, but that doesn't really help me figure out what
> > it is the admin wants that I'm not giving it.
>
> > --
> > 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.
> > For more options, visit this group 
> > athttp://groups.google.com/group/django-users?hl=en.

-- 
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.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Custom admin changelist queryset

2011-11-17 Thread bax...@gretschpages.com
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 ...
  return combined


I can return qs1 or qs2 to the admin, no problem. But I can't put them
together in a way the admin will accept.

First thing I tried was a simple itertools.chain. I've also tried
building a custom queryset (http://djangosnippets.org/snippets/1933/)
and subclassing queryset. At best, I get nothing, but most times I
get:

"Database error
Something's wrong with your database installation. Make sure the
appropriate database tables have been created, and make sure the
database is readable by the appropriate user."

Which I've tracked down to a IncorrectLookupParameters exception in
contrib.admin.options, but that doesn't really help me figure out what
it is the admin wants that I'm not giving it.



-- 
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.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: Is there a standard way to implement the top level of my site?

2011-11-07 Thread bax...@gretschpages.com


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 settings.py, I imagine). I tried implementing it
> in urls.py, but it has some sort of syntax error:
>
> urlpatterns = patterns('',
>     (r'^polls/', include('polls.urls')),
>     (r'^admin/', include(admin.site.urls)),
>     (r'^$', TemplateView.as_view(template_name = '404.html'),
> )
>

If you're on Django prior to 1.3, you probably want the simple
direct_to_template generic view (which does still work in 1.3):
https://docs.djangoproject.com/en/dev/ref/generic-views/?from=olddocs#django-views-generic-simple-direct-to-template

If you ARE on 1.3, make sure you're importing TemplateView before you
try to use it.
from django.views.generic import TemplateView

Also, if you are going to do it all with template tags, watch your
queries. I think it's easier for them to spiral out of control with
template tags.

-- 
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.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: firstof as

2011-11-07 Thread bax...@gretschpages.com


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, do a bit more work to get something that
will fill the current need. Or, in other words, maybe I'm storing it
locally, or maybe I'm not.

Another example:

{% with firstof obj.votes obj.get_votes as votes %}
Which would then let me do something with votes: "There have been
{{ votes }} vote{{ votes|pluralize }}.

-- 
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.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: bar charts

2011-11-07 Thread bax...@gretschpages.com
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 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/group/django-users?hl=en.



Re: Is there a standard way to implement the top level of my site?

2011-11-07 Thread bax...@gretschpages.com
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  wrote:
> I'm not exactly clear on the question, but I'll share with you what I've
> done on my site.
>
> For pages like the "Home Page", I've created an application called "core".
> Then I just call my .core.views.HomePageView.as_view() from the
> "urls.py" file under my main project directory. The regular expression I
> use, which is also an example in the default urls.py, is simply u'^$' (I
> think -- I'd have to double check).
>
> Hopefully that helps a little bit, sorry if I was completely off. I do kind
> of get the feeling that you want a views.py right in your project root. I
> believe it's possible (I've seen examples of it somewhere in the docs) but
> I personally don't go that route and have never tried it.
>
> Also, if your home page is just a simple template and there's no need for a
> lot of functionality behind it, you can do this:
>
> url(u'^$', TemplateView.as_view(template_name = 'home_page.html')),
>
>
>
>
>
>
>
> On Mon, Nov 7, 2011 at 2:12 PM, M. Herold  wrote:
> > I've developed a number of apps and stuck them into my django
> > framework, but in looking to create a hub at the index of my site
> > (among other standard pages; e.g. about, network, etc.), I've sort of
> > gotten stuck. Do I really want to create another app and just redirect
> > from my index, having a sort of "index" app? Is there a clever way to
> > have a "top level" app?
>
> > Thanks in advance
> > Michael
>
> > --
> > 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.
> > For more options, visit this group at
> >http://groups.google.com/group/django-users?hl=en.

-- 
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.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



firstof as

2011-11-07 Thread bax...@gretschpages.com
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 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/group/django-users?hl=en.



Trying to understand db.reset_queries()

2011-08-05 Thread bax...@gretschpages.com
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 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.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: Django - modifying navigation design

2011-08-05 Thread bax...@gretschpages.com
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 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: Django for a front end designer

2011-08-05 Thread bax...@gretschpages.com
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 finding Jeff Croft's Django for designers blog
post from a few years back. It's a little out of date, but still worth
reading.

-- 
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.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: Getting "most"

2011-05-27 Thread bax...@gretschpages.com
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:
>
> from django.models import count
> most = Watch.objects.values('content_type', 
> 'object_id').annotate(Count('object_id')).order_by('-object_id__count')
>
> [
>         {'object_id__count': 15, 'object_id': 1, 'content_type': 10},
>         {'object_id__count': 2, 'object_id': 1, 'content_type': 5},
>         ...
> ]
>
> # this isn't efficient, but you get the idea
> # you need to resolve the content types and object id's into models
> from django.contrib.contenttypes.models import ContentType
> for object in most:
>         foo = ContentType.objects.get(id= 
> object['content_type']).get_object_for_this_type(object['object_id'])
>
> You can also seehttps://github.com/coleifer/django-generic-aggregation
>
> This will get you close but I think it only if you want to annotate the count 
> on a single content type at once.
>
> Jason Culverhousehttp://www.mischievous.org

-- 
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.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Getting "most"

2011-05-27 Thread bax...@gretschpages.com
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()
object_id = models.IntegerField('object ID')
created = models.DateTimeField(auto_now_add=True)


What I'm trying to do is get the most-watched objects.
I saw James Bennett's snippet from 2007 (http://djangosnippets.org/
snippets/108/) which looks like it would work (subbing my Watch model
for comments), but I'm wondering if there's a better way to do it with
newer versions of django, possibly through annotate or aggregate?

-- 
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.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



500.html and STATIC_URL

2011-05-25 Thread bax...@gretschpages.com
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 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/group/django-users?hl=en.



Re: server connection dropped? IO Error? What's going on?

2010-12-20 Thread bax...@gretschpages.com


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 responses. When I loaded the page, this was for (what looks
> like) static files, which you say are being served by nginx.
>
> I don't see how django gets involved in this, which is probably part
> of the reason why you aren't getting any responses on this list. Try
> asking on a nginx list.
>
> As a wild stab in the dark, does it still happen when you turn
> sendfile off in nginx [1]? If so, that points to an OS/nginx bug.
>
> Cheers
>
> Tom
>

Tom, I initially thought it was an nginx thing as well, but I don't
believe so any more. I don't think that would explain why it fails on
this topic EVERY time, and every other topic NONE of the time. I think
the failure to load some static media is a sympton, not the actual
problem. Turning sendfile off did not change the behavior at all.

Plus I have no errors in my nginx logs. Problem is, I can't find
anything about that particular topic that would cause any problem.
That topic (and a couple of others) will error every time, while all
the other pages on the site don't, ever.

I do think whatever it is, it's very low in the stack. Maybe
middleware?

-- 
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.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: server connection dropped? IO Error? What's going on?

2010-12-20 Thread bax...@gretschpages.com
> 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 to download if not.

I'm pretty sure it's nothing in my styles though, as it has only hit
about 5 pages out of about 50,000.

-- 
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.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



server connection dropped? IO Error? What's going on?

2010-12-20 Thread bax...@gretschpages.com
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 here:
http://gretschpages.com/forum/your-tunes/five-min-love-affair/36446/page1/

On initial load, you'll probably see one or two static elements fail
to load.
If you hit reload or follow any link from that page, you'll either get
ALL static media fail to load, or the page will not load at all,
giving some sort of "server busy" message.

That topic will do it every time. Pretty much every place else on the
site will not. The server is not busy, it's something about that
topic, and the handful of others this thing has hit.

I can't find any commonality among the problem topics/posts. All other
posts/topics are fine.
If I copy all the info from the problem topic into a new one, it posts
fine.
If that user posts another topic, it works fine.

Server config is Nginx is handling static media and passing django
stuff over to Apache.

I don't see anything in the nginx or apache error logs, and nothing
looks off in the database, either.

Any suggestions on where to look or how to debug this?

-- 
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.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: Very strange lost network connection problem

2010-12-16 Thread bax...@gretschpages.com
Sorry for responding to my own post -- trying to add some additional
info.

Because of the way it's behaving, I'm wondering if it's middleware
related. Seems to be at a very low level in the request/response
cycle. So with that in mind, this is my middleware below. Does the
order look OK?
MIDDLEWARE_CLASSES = (
   'django.middleware.cache.UpdateCacheMiddleware',
   'django.middleware.common.CommonMiddleware',
'django.contrib.sessions.middleware.SessionMiddleware',
'django.middleware.csrf.CsrfViewMiddleware',
'django.contrib.auth.middleware.AuthenticationMiddleware',
'django.contrib.messages.middleware.MessageMiddleware',
'django.middleware.doc.XViewMiddleware',
 'django.contrib.flatpages.middleware.FlatpageFallbackMiddleware',
'django.middleware.http.ConditionalGetMiddleware',
'django.middleware.csrf.CsrfResponseMiddleware',
'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 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:
>
> http://gretschpages.com/forum/electromatics/on-the-2nd-day-of-christm...
>
> On initial load, you'll probably see at least a couple of images error
> out with a lost network connection error or "Failed to load resource",
> depending on what browser you're looking in. Or it may lose all static
> media. Hard to tell what it's going to do from one page load to the
> next.
>
> If you hit reload, it will probably lose ALL static media.
>
> If you were to try to add a post, it would go to a blank "server
> unexpectedly dropped the connection" type of page.
>
> It's just two or three topics. All others are unaffected. Whatever the
> problem, it seems to be centered on just these few topics.
>
> Nginx is handling static media and passing django stuff over to
> Apache.
>
> I don't see anything in the nginx or apache error logs.
>
> I've looked in the database, and nothing appears out of the ordinary
> with these topics, either.
>
> Any suggestions on where to look or how to debug this?

-- 
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.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Very strange lost network connection problem

2010-12-16 Thread bax...@gretschpages.com
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:

http://gretschpages.com/forum/electromatics/on-the-2nd-day-of-christmas-my-true-love-gave-to-me/36273/page1/

On initial load, you'll probably see at least a couple of images error
out with a lost network connection error or "Failed to load resource",
depending on what browser you're looking in. Or it may lose all static
media. Hard to tell what it's going to do from one page load to the
next.

If you hit reload, it will probably lose ALL static media.

If you were to try to add a post, it would go to a blank "server
unexpectedly dropped the connection" type of page.

It's just two or three topics. All others are unaffected. Whatever the
problem, it seems to be centered on just these few topics.

Nginx is handling static media and passing django stuff over to
Apache.

I don't see anything in the nginx or apache error logs.

I've looked in the database, and nothing appears out of the ordinary
with these topics, either.

Any suggestions on where to look or how to debug this?

-- 
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.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



server configuration

2010-10-29 Thread bax...@gretschpages.com
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 MPM is better. But then I read you can't use prefork
if wsgi is in daemon mode.

So I'm confused, and hoping someone can clarify for me.

-- 
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.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Legacy URLs redirect

2010-10-11 Thread bax...@gretschpages.com
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:
(r'^?q=taxonomy/term/[0-9]+$', redirect_to, {'url': '/', 'permanent':
True}),

And failed most spectacularly. Do I need to be escaping something, or
what am I missing?

-- 
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.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



admin login problems and 'ValidationError: [u'ManagementForm data is missing or has been tampered with'] '

2010-08-19 Thread bax...@gretschpages.com
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 times, until eventually it fails with
ValidationError: [u'ManagementForm data is missing or has been
tampered with']

It does not matter what project, app or model they are going to. It's
not even the same admin's... it's actually spread across several
projects/sites. The only thing they share is that they're both using
the same basic Django 1.1 install.

Any ideas?

-- 
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.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: portable apps problem

2010-08-05 Thread bax...@gretschpages.com
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 django-us...@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/group/django-users?hl=en.



portable apps problem

2010-08-05 Thread bax...@gretschpages.com
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 same articles app. Problem is, the articles app was
originally written for site A,and has at least one M2M relationship
with another app that site B does not have, need, or really want. So,
how do I give site A what it needs without cluttering up Site B with a
bunch of unwanted extras, while using the same app?

-- 
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.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: Problem with management command

2010-07-20 Thread bax...@gretschpages.com


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 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.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Problem with management command

2010-07-20 Thread bax...@gretschpages.com
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 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.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Problem with DateField input_formats

2010-06-23 Thread bax...@gretschpages.com
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', # 'October 25 2006', 'October 25, 2006'
)


class CandidateProfileForm(forms.ModelForm):
class Meta:
model = Person
dob = forms.DateField(input_formats=DATE_INPUT_FORMATS)


But I'm not getting my date format through. For example, 4-20-1990
fails, even though I think it should be covered by %n-%j-%Y

I've also tried:
class CandidateProfileForm(forms.ModelForm):
class Meta:
model = Person
widgets = {
'dob':
forms.DateField(input_formats=DATE_INPUT_FORMATS),
}

with no luck. What am I missing here?

-- 
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.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: User-level permissions?

2010-06-11 Thread bax...@gretschpages.com
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 at the
> user level I can only assign groups -- I can no longer just add
> individualpermissionsto that individual user.
>
> Any suggestions on where the functionality may have gone?
>
> I don't think I've done anything to much about with
> django.contrib.auth.

-- 
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.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



User-level permissions?

2010-06-07 Thread bax...@gretschpages.com
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 have gone?

I don't think I've done anything to much about with
django.contrib.auth.

-- 
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.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Trouble with comment moderation

2010-05-28 Thread bax...@gretschpages.com
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 comments are marked
as public.

-- 
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.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: Restarting the server while working on dreamhost.

2010-05-16 Thread bax...@gretschpages.com
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 django-us...@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/group/django-users?hl=en.



Re: Server on diffferent machine

2010-05-16 Thread bax...@gretschpages.com
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 from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: Server on diffferent machine

2010-05-16 Thread bax...@gretschpages.com


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 the IP, it fails. Strange.
>
> My 2p is on the db machine not having the right port open or denying
> non-local connections.

It's definitely port 3306 (double-checked). Not sure about non-local
connections. And the ping thing is weird to me.

-- 
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.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: Pluggable QA app?

2010-05-16 Thread bax...@gretschpages.com
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 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.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Server on diffferent machine

2010-05-16 Thread bax...@gretschpages.com
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 on the default port 3306. I do not have a domain assigned to
this server, only a raw IP.

On the django side, I'm not sure what my settings should be to connect
to it. So far, everything I've tried has resulted in
_mysql_exceptions.OperationalError: (2005, "Unknown MySQL server host
'< THE IP >' (1)")

Settings.py looks like:

DATABASES = {
'default': {
'ENGINE': 'django.db.backends.mysql',
'NAME': 'django',
'USER': '',
'PASSWORD': 'XXX',
'HOST': '< THE IP >',
'PORT': '3306',
}
}

What am I missing?

-- 
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.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Pluggable Q app?

2010-05-14 Thread bax...@gretschpages.com
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 other site, just an app.

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-us...@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/group/django-users?hl=en.



Re: Problem using django-typogrify and smartypants

2010-04-16 Thread bax...@gretschpages.com
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 to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: forms.py and javascript functions

2010-04-15 Thread bax...@gretschpages.com
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 unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: Problem using django-typogrify and smartypants

2010-04-15 Thread bax...@gretschpages.com
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 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.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: need help, from where I have to start ?

2010-04-14 Thread bax...@gretschpages.com
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 application examples
> written   with Django, I just start reading django view weeks ago and
> I need your help.thank you bye.

-- 
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.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: Problems with comment form customization ?

2010-04-13 Thread bax...@gretschpages.com
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 
"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.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: get_comment_count templatetag

2010-04-13 Thread bax...@gretschpages.com
Actually, on the first one, I would just define it in the model. So if
you have Blog.entry, under entry there would be

def get_comment_count(self):
   do stuff

and in the template, you'd just say entry.get_comment_count



On Apr 13, 2:01 am, fuxter <fuxt...@gmail.com> wrote:
> yeap, that's another way this could be done. incrementing
> comments_count on signal.
> actually, i'm inclined to your first method, since it's seems easier
> for my to accomplish. i'm also considering writing a templatetag just
> for the practice. nevere have i need to write templatetag till 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 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 saved, something like (and excuse the pseudo-code)
> > if this.parent = object or this.parent.parent = object: comment.count
> > += 1
>
> > On Apr 12, 2:18 pm, fuxter <fuxt...@gmail.com> wrote:
>
> > > hey everyone,
> > > i'm a young django user and need some advice or opinions on the way of
> > > general use.
>
> > > in my application (blog-like site) i have objects and they can have
> > > comments. i also decided to implement limited comment reply feature.
> > > so the objects can have comments, and those comments can have comments
> > > as well. it turn out to be one level nested comments. comments for
> > > comments can't have replies.
>
> > > at this point i'm stuck with get_comment_count template tag that
> > > returns only object's comments count, naturally. and i need to count
> > > all the replies altogether.
>
> > > so my question is how would you do that? should i add a method to
> > > commented object that would count all the replies? maybe i could hack
> > > the comments/templatetags framework? or should i write my own
> > > templatetag?
>
> > > i guess all the options are pretty usable and they don't cross the
> > > django way, which is very liberal. i just wanted to know you opinion,
> > > what would you prefer?
>
> > > ps: pardon my russian =)

-- 
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.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: what lines in the templates are culpable?

2010-04-12 Thread bax...@gretschpages.com
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 mean the problem was actually in the template.
Template tags, for example, can throw errors.

-- 
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.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: what lines in the templates are culpable?

2010-04-12 Thread bax...@gretschpages.com
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
> > where the error is. Without the traceback, it's hard to say where your
> > problem lies.
>
> One of the templates is "basket.html", and "basket.html" does not
> appear in the transcript.
>
> All the lines are only django's internal render() calls (including
> inside debug.py), and our action handler itself.
>
> The top line is the test method name.
>
> (Also, manual test does not fail, so that naturally is on us, but I
> think that's where you think the transcript might be more explicit.)

-- 
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.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: what lines in the templates are culpable?

2010-04-12 Thread bax...@gretschpages.com
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
> detailed stack trace of all the lines AROUND the template.
>
> How do I tell what lines INSIDE the templates caused the error?
>
> --
>   Phlip
>  http://c2.com/cgi/wiki?ZeekLand

-- 
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.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



generic comments

2010-04-12 Thread bax...@gretschpages.com
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 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.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: get_comment_count templatetag

2010-04-12 Thread bax...@gretschpages.com
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 saved, something like (and excuse the pseudo-code)
if this.parent = object or this.parent.parent = object: comment.count
+= 1



On Apr 12, 2:18 pm, fuxter  wrote:
> hey everyone,
> i'm a young django user and need some advice or opinions on the way of
> general use.
>
> in my application (blog-like site) i have objects and they can have
> comments. i also decided to implement limited comment reply feature.
> so the objects can have comments, and those comments can have comments
> as well. it turn out to be one level nested comments. comments for
> comments can't have replies.
>
> at this point i'm stuck with get_comment_count template tag that
> returns only object's comments count, naturally. and i need to count
> all the replies altogether.
>
> so my question is how would you do that? should i add a method to
> commented object that would count all the replies? maybe i could hack
> the comments/templatetags framework? or should i write my own
> templatetag?
>
> i guess all the options are pretty usable and they don't cross the
> django way, which is very liberal. i just wanted to know you opinion,
> what would you prefer?
>
> ps: pardon my russian =)

-- 
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.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: Problems with comment form customization ?

2010-04-12 Thread bax...@gretschpages.com
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 %}
  
{{ field.label_tag }} {{ field }}
  
{% endif %}
  {% endfor %}

Looping through the fields, and if the field is honeypot, setting
display:none

That's all in django/contrib/comments/templates/comments/form.html


On Apr 12, 2:35 pm, Ariel  wrote:
> Hi everybody:
>
> I am implementing comments functionalities in my web application, I am
> making the documentation examples.
> I have customized my comment form exaxtly like the documentation:
>
> {% get_comment_form for document as form %}
> 
>   {{ form }}
>   
>      value="Preview">
>   
> 
>
> But the thing is that a field that is suppossed to be hidden is
> visible and that is what I don't want, the field name is 'honeypot'
> This is a normal behavior ?
> Do anyone of you know how to make that field hidden again ???
> Thanks in advance.
> Ariel

-- 
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.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: HTML code shown on web page after template render.

2010-03-29 Thread bax...@gretschpages.com
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 html tags in a database. When I
> pass the content for rendering with a template through the Django
> templating system the web page actually prints the html tags rather
> than parsing through the browser (for instance  actually prints
>  rather than creating headed text in the browser). Should I
> presume that I have to create all html in the templates or is there a
> way to build html code inside a view and then pass it to a template?
>
> 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-us...@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/group/django-users?hl=en.



Re: Weird path problem

2010-03-29 Thread bax...@gretschpages.com
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.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Weird path problem

2010-03-29 Thread bax...@gretschpages.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
fine. Installed apps are loading, I see everything in the admin, etc.
My problem is that django-admin.py isn't seeing the apps. For example,
if I run
python django-admin.py sql app1 --settings=myproject.settings

-- 
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.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: Need limit_choices_to help

2010-03-19 Thread bax...@gretschpages.com
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. Tips?

-- 
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.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Need limit_choices_to help

2010-03-19 Thread bax...@gretschpages.com
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
roster for that game.

In my head, it should be something like
playmaker   = models.ForeignKey(Player, limit_choices_to=
{'id': 'game__roster'},

Or am I looking at it all wrong? Should I build a choice list from
roster on the fly and use that? OR can I just foreignKey straight to
Game__roster?

Help!

-- 
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.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: Django and Online Payment Systems

2010-03-04 Thread bax...@gretschpages.com
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 had to be US.

On Mar 4, 4:50 pm, MauroCam  wrote:
> Hi,
>
> has anyone got any pointers on good - preferably localisable -
> integrations between a Django web-site and online payment system?
>
> 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-us...@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/group/django-users?hl=en.



actions and/or customizing the admin best practices

2010-02-01 Thread bax...@gretschpages.com
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 items in the changelist.

While I was looking that up, I saw a suggestion to make it one of the
object-tools buttons, but from there I went down a rabbit hole of new
APIs and other questions centering around what exactly is the best way
to customize the admin these days.

So: currently using 1.1.1 final, but could update to a newer version,
what is the simplest/best way to add my function into the admin?

-- 
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.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: Multiple vhosts in one django project

2010-01-05 Thread bax...@gretschpages.com


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 it should use Book class but will query project2 database, not
> project1 database.
>
They share data but have separate databases?
-- 
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.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.




Re: Problem importing datetime from xml

2009-12-29 Thread bax...@gretschpages.com
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 to the start time fixed it.

--

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.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.




Re: Problem importing datetime from xml

2009-12-29 Thread bax...@gretschpages.com
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 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
> pulled in. Suggestions?

--

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.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.




Problem importing datetime from xml

2009-12-21 Thread bax...@gretschpages.com
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
pulled in. Suggestions?

--

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.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.




Re: Can I change the models.py of an existing django app?

2009-12-11 Thread bax...@gretschpages.com
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:
> >> python manage.py syncdb
> >> The syncdb command runs the sql from 'sqlall' on your database
> >> for all apps in INSTALLED_APPS that don't already exist in your database.
> >> This creates all the tables, initial data and indexes for any apps
> >> you have added to your project since the last time you ran syncdb.
> >> syncdb can be called as often as you like,
> >> and it will only ever create the tables that don't exist.
>
>                          ^^
>
> So, it seems that, according to documentation, syncdb will create the
> new tables?
>
> I am using sqlit3, by the way.

No it will "create those model tables in your database" ... "for all
apps in INSTALLED_APPS that don't already exist in your database" ...
"and it will only ever create the tables that don't exist."

If the table already exists, you will need to manually modify it. For
sqlite3, I would suggest the Firefox sqllite manager plugin, which
makes editing the tables pretty easy.

--

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.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.




Re: Can I change the models.py of an existing django app?

2009-12-11 Thread bax...@gretschpages.com
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. You'll need to go to your
database, either through the command line or through a tool like
phpmyadmin and add the new fields manually. You can, however, run
manage.py sql YOURAPP to see what the table should look like.

--

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.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.




Re: Can I change the models.py of an existing django app?

2009-12-11 Thread bax...@gretschpages.com
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 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.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.




Re: Show additional user information in admin

2009-12-03 Thread bax...@gretschpages.com

> 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 ProfileInline(admin.TabularInline):
model = Profile

UserAdmin.inlines = [ProfileInline]

--

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.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.




Re: reading iptc info

2009-12-03 Thread bax...@gretschpages.com
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 unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.




reading iptc info

2009-12-03 Thread bax...@gretschpages.com
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 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.




Copying files from remote server

2009-11-24 Thread bax...@gretschpages.com
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 file, and it could disappear someday. I'm trying to
save a local copy of the files, but can't seem to get it working
properly. From what I can tell, I'm copying the file OK, but the image
model doesn't see it.

my view is here: http://pastebin.com/m7eee7ff2

--

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.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.




Re: debug toolbar problem

2009-11-02 Thread bax...@gretschpages.com

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 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/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: debug toolbar problem

2009-11-02 Thread bax...@gretschpages.com

> 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',
'django.contrib.sessions.middleware.SessionMiddleware',
'django.contrib.auth.middleware.AuthenticationMiddleware',
'django.middleware.doc.XViewMiddleware',
'django.contrib.flatpages.middleware.FlatpageFallbackMiddleware',
'django.middleware.cache.CacheMiddleware',
'utils.lastseen.LastSeen',
'utils.ban_middleware.IPBanMiddleware',
'debug_toolbar.middleware.DebugToolbarMiddleware',
)



DEBUG_TOOLBAR_PANELS = (
#'debug_toolbar.panels.version.VersionDebugPanel',
'debug_toolbar.panels.timer.TimerDebugPanel',
#'debug_toolbar.panels.settings_vars.SettingsVarsDebugPanel',
'debug_toolbar.panels.headers.HeaderDebugPanel',
'debug_toolbar.panels.request_vars.RequestVarsDebugPanel',
'debug_toolbar.panels.template.TemplateDebugPanel',
'debug_toolbar.panels.sql.SQLDebugPanel',
'debug_toolbar.panels.signals.SignalDebugPanel',
'debug_toolbar.panels.logger.LoggingPanel',
)



def custom_show_toolbar(request):
if request.user.is_superuser:
   return True # Always show toolbar, for example purposes only.
return False

DEBUG_TOOLBAR_CONFIG = {
'INTERCEPT_REDIRECTS': False,
'SHOW_TOOLBAR_CALLBACK': custom_show_toolbar,
   # 'EXTRA_SIGNALS': ['myproject.signals.MySignal'],
'HIDE_DJANGO_SQL': False,
}

INSTALLED_APPS = (
...
'debug_toolbar',
)


I see the bars, and most appear to be working ( like version, for
example, before I turned it off), but nothing on SQL
--~--~-~--~~~---~--~~
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
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



debug toolbar problem

2009-11-01 Thread bax...@gretschpages.com

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 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
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: upload problems

2009-10-28 Thread bax...@gretschpages.com

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 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/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: upload problems

2009-10-28 Thread bax...@gretschpages.com



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.
>
>
> Have you changed ADMIN_MEDIA_PREFIX 
> (http://docs.djangoproject.com/en/dev/ref/settings/#admin-media-prefix) from
> its default of the same thing?
>
ADMIN_MEDIA is set to "admin_media", because I like the regular media
to be at /media.

>
>
> For now, while it's just in test, I have this in URLS.py:
>
> >    (r'^media/(?P.*)$', 'django.views.static.serve',
> >        {'document_root': '/Users/tbaxter/Sites/django-media/ink/',
> > 'show_indexes': True}),
>
> This won't have any effect if ADMIN_MEDIA_PREFIX is also /media/.  The
> development server special-cases requests for admin media (that is, any path
> that starts with ADMIN_MEDIA_PREFIX) and they don't go through normal url
> resolution.

But it's not

>
> It sounds like your images are uploading, you just can't see them on the
> site after you've uploaded them because your requests for them are being
> routed to the admin media server, which can't find them where it looks (in
> the Django source tree).

No, it's not that I can't see them on the site. They're not in the
filesystem. They're not there, anywhere, as far as I can see.

--~--~-~--~~~---~--~~
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
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



upload problems

2009-10-27 Thread bax...@gretschpages.com

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 this in URLS.py:

(r'^media/(?P.*)$', 'django.views.static.serve',
{'document_root': '/Users/tbaxter/Sites/django-media/ink/',
'show_indexes': True}),

I've checked permissions on every directory.

When I attempt to upload I get no error.
I see the filename in the admin.
If I click it, I 404. Also, a slash is appended.

If I back up to the /media/img/ directory, nothing.

I'm sure I've just got something configured wrong. I've never used
django on a local machine before, so the paths and such are a bit
different than I'm used to.
Anyone see where I've gone wrong?

--~--~-~--~~~---~--~~
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
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Missing error report

2009-10-05 Thread bax...@gretschpages.com

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 11:00
today.

Is there some place this exception could be raised before the email
reporting would kick in?

And more importantly, how do I track down the code that's raising the
error?
--~--~-~--~~~---~--~~
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
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Keeping request.GET keys

2009-09-30 Thread bax...@gretschpages.com

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 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
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Strange upload problem

2009-07-28 Thread bax...@gretschpages.com

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 = models.FileField(upload_to='files/events/special/
results/', blank=True, null=True)
   ...
   def save(self):
if self.id is not None:
old_self = self.__class__.objects.get(id = self.id)
if self.results_csv and (self.results_csv.name !=
old_self.results_csv.name):
for i, line in 
enumerate(open(self.results_csv.name)):
[do stuff]

super(SpecialEvent, self).save() # Call the "real" save() 
method.

I'm getting an IOError: [Errno 2] No such file or directory: u'files/
events/special/results/utcc-results.csv'

When I look in the directory, I see the file. Is it not there yet when
it's trying to open it? Should I maybe use a post save signal or
something instead?

--~--~-~--~~~---~--~~
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
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Admin login needs to be https

2009-07-08 Thread bax...@gretschpages.com

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 wasn't, since I feel like that would open up a whole new can
of worms. But I need that login page to go to https.

Suggestions?

--~--~-~--~~~---~--~~
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
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Password-protecting PDF downloads?

2009-06-29 Thread bax...@gretschpages.com

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 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/group/django-users?hl=en
-~--~~~~--~~--~--~---



request.session in template tag?

2009-06-01 Thread bax...@gretschpages.com

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?
--~--~-~--~~~---~--~~
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
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Google website optimizer--A/B testing

2009-05-12 Thread bax...@gretschpages.com

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, 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/group/django-users?hl=en
-~--~~~~--~~--~--~---



Trying to figure out "featured for month" view

2009-04-28 Thread bax...@gretschpages.com

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  = [(str(y), str(y)) for y in range(datetime.date.today
().year, datetime.date.today().year+1)]

then in the view,
have something like
Foo.objects.get(featured_for_year=datetime.date.today().year,
featured_for_month=datetime.date.today().month)

Sound reasonable? Is there a better way to do this?

--~--~-~--~~~---~--~~
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
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Problem creating object

2009-04-20 Thread bax...@gretschpages.com

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(
...
sites = site,
..
)

I'm getting a type error
TypeError: 'sites' is an invalid keyword argument for this function

What am I doing wrong here?


--~--~-~--~~~---~--~~
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
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Problem querying database

2009-04-15 Thread bax...@gretschpages.com

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 article for each category, but NOT the
two most recent articles.

I'm trying this:

articles = Article.objects.filter(publication='Published',
assigned_to=subcat).order_by('-id')[2:]
subcat.article = articles.order_by('?')[0]

Which should get all the articles for the subcat except the two most
recent ones, then select one random one from that list, except I'm
running into "AssertionError: Cannot reorder a query once a slice has
been taken."

So, how can I do this?
--~--~-~--~~~---~--~~
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
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Generating USER documentation?

2009-04-10 Thread bax...@gretschpages.com

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 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-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/group/django-users?hl=en
-~--~~~~--~~--~--~---



User registration issues

2009-04-09 Thread bax...@gretschpages.com

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
registration profile (I'm using django-registration) but not the site
user profile. I'd say probably 80% of the registrations go without a
hitch. Of the remaining 20%, almost all of them work on the second
attempt (after I delete the first, failed registration), but a handful
still haven't worked.

I wonder if it may be browser-related. I can register all of these
people myself with no problem using Firefox or Safari.

I'm using an older version of django-registration. I believe it's 0.3
-- it still uses profile-callback. Thinking that maybe there was a
problem with the older version and django 1.0, I figured I would
upgrade to the latest version.

I'm still not sure if that will fix the problem, because I
registrations with the latest version of django-registration are all
failing with "Signal receivers must accept keyword arguments
(**kwargs)" when I follow the activation link.
--~--~-~--~~~---~--~~
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
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



update facebook status

2009-03-19 Thread bax...@gretschpages.com

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.
--~--~-~--~~~---~--~~
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
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Signals, sites and instances

2009-03-19 Thread bax...@gretschpages.com

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 can go on one site or both.

So I need to make sure I'm posting the news item to the correct
twitter account. Based on that earlier question, I have:

if instance.sites.filter(id=1):
   do stuff for first site
if instance.sites.filter(id=2):
   do stuff for other site
else:
   return false

This is failing to post when the news item is first created. If I re-
save the item, THEN it will post. I believe it's because
instance.sites is still an empty list at this stage (not yet been
created).

So what can I do? Is the POST info available to the signal maybe?

--~--~-~--~~~---~--~~
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
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Simple sites framework question

2009-03-16 Thread bax...@gretschpages.com

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?
--~--~-~--~~~---~--~~
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
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



dynamic select boxes in forms with jquery

2009-03-13 Thread bax...@gretschpages.com

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 cars, like the Neon, for example, fall under more
than one make)

When the user selects  the Car (make), I want to only show the models
for that make.

Help?
--~--~-~--~~~---~--~~
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
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Need help with combined feed

2009-03-09 Thread bax...@gretschpages.com

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 items(self):
combined = []
articles=   Article.objects.all().order_by('-created')[:
40]
events  =   
Event.objects.filter(start_date__gte=now).order_by
('start_date')[:50]
news=   
News_item.objects.filter(pub_date__lte=now).order_by('-
pub_date')[:20]
combined=   itertools.chain(news, articles, projects, 
issues,
events)
for item in combined:
   try:
  item.date = item.created
   except:
  try:
item.date = item.topic_modification_date
  except:
 try:
item.date = item.pub_date
 except:
try:
   item.date = item.start_date
except:
   item.date = now
return combined


Which doesn't appear to do anything. No error, but no ojb in
combined.html, either.
Suggestions?
--~--~-~--~~~---~--~~
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
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Big Django site gone

2009-02-27 Thread bax...@gretschpages.com

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 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
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Problem tapping into Amazon web service

2009-02-26 Thread bax...@gretschpages.com

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?
Service=AWSECommerceService=mykey=myID=ItemSearch=myAuthor=Books=Medium").read
()

xml = xmltramp.parse(amazonfile)

for item in xml.Items:
   ""do stuff. For purposes of debugging..."
  print item.ItemAttributes.Title

It fails with "no child element named ItemAttributes"

Looking at the XML, I clearly see ItemAttributes as a child of Items.

When I have it print xml, I'm not seeing an xml format, so that's why
I'm suspecting some kind of unicode or escaping problem.

Thoughts?


--~--~-~--~~~---~--~~
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
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Years

2009-02-13 Thread bax...@gretschpages.com

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 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Years

2009-02-13 Thread bax...@gretschpages.com

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?
--~--~-~--~~~---~--~~
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
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: sites framework

2009-02-12 Thread bax...@gretschpages.com

> 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 myproject.eventsapp.models
>

My structure isn't quite the same as yours, but in my experience
manage.py gets confused with multiple sites. Try
python django-admin.py  --settings=exposite.settings
--~--~-~--~~~---~--~~
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
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: JavaScript Slider in Django Form

2009-01-23 Thread bax...@gretschpages.com

> 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 that.

--~--~-~--~~~---~--~~
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
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: "connect a function to the signal"

2009-01-23 Thread bax...@gretschpages.com


> 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 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/group/django-users?hl=en
-~--~~~~--~~--~--~---



"connect a function to the signal"

2009-01-23 Thread bax...@gretschpages.com

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'^$',
   register, {'profile_callback':
create_site_user},
   name='registration_register'),


In .7 the docs say "connect a function to the signal" but I guess I
don't understand.
I have the signal
user_activated = Signal(providing_args=["user"])

and I have my create_site_user function, but I'm not clear on how I
insert tab A into slot B.

I know how stupid I sound. I've looked at the signals docs, I've
looked at the django-registration docs. I know this is simple, but I'm
not getting it.
--~--~-~--~~~---~--~~
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
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



update_object acting strangely

2009-01-22 Thread bax...@gretschpages.com

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 False. This is happening on at least
two different models, and I've never noticed it until the past week or
so. Suggestions?
--~--~-~--~~~---~--~~
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
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Suspicious Operation/ filestorage problem

2009-01-19 Thread bax...@gretschpages.com



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.
--~--~-~--~~~---~--~~
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
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Suspicious Operation/ filestorage problem

2009-01-19 Thread bax...@gretschpages.com

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. Problem, is, later when I try to get height of
avatar (siteuser.avatar.height) It fails whenever the avatar is
default. gif with a suspicious operation error:

...
 File "/home/grmadmin/webapps/django/lib/python2.5/django/core/files/
storage.py", line 204, in path
   raise SuspiciousOperation("Attempted access to '%s' denied." %
name)

SuspiciousOperation: Attempted access to '/img/avatars/default.gif'
denied.

I've checked permissions on default.gif, but that doesn't appear to be
it.
I can call siteuser.avatar with no problem, but siteuser.avatar.height
fails every time, if the avatar is default.gif



--~--~-~--~~~---~--~~
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
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



  1   2   >