Re: How to log the cause of a 500 error

2008-11-05 Thread Eric Abrahamsen
On Nov 6, 2008, at 6:11 AM, Delta20 wrote: > > I just realized that I accidentally named the template 400.html not > 404.html... d'oh. I definitely need a better way of diagnosing 500 > errors. > > Thanks to the pointer to the email settings. I will set that up, but > I'm wondering if there's a

Re: Forms Question

2008-11-03 Thread Eric Abrahamsen
On Nov 4, 2008, at 8:14 AM, Robocop wrote: > > I'm working with some rather long forms, and i've processed them in a > pretty basic way. I read in the post data for every field, then just > create a new table entry using the form data. > > Something like: > if request.method == 'POST': > if

Re: Syndication Feed-Problem

2008-10-30 Thread Eric Abrahamsen
On Oct 30, 2008, at 7:04 PM, [EMAIL PROTECTED] wrote: > > Hi, > i hope any one can help me. > I want to generate a rss-feed. > The url ist http://localhost:8000/isf/info/. > All works fine but the title of an Item and the Description are still > the same! > How can i change the title of an feed

Re: comment_was_posted

2008-10-29 Thread Eric Abrahamsen
On Oct 29, 2008, at 6:01 PM, sam wrote: > > hello, > > I try to redirect a user who comments a post on my blog to the same > page, > to do that, i need to use the signal : 'comment_was_posted' > > i have put the code below in my blog 'models.py' to be sure it has > been loaded, > but when i

Re: Problem with contrib.comments and signals: instance is not defined

2008-10-24 Thread Eric Abrahamsen
On Oct 24, 2008, at 12:23 PM, Brandon Taylor wrote: > > Hi everyone, > > I'm using Django 1.0, and attempting to do some comment moderation > with Akismet. When I try to wire up a pre_save signal, I'm getting an > error saying 'instance' is not defined. Here is my code: You might also consider

Re: Returning Queryset that excludes certain results from another queryset.

2008-10-20 Thread Eric Abrahamsen
On Oct 21, 2008, at 5:38 AM, timc3 wrote: > > So I have a model that looks like this: > > class GroupsOfUser(models.Model): >name = models.CharField(_("Name"), max_length=50) >description = models.TextField(_("Description"), blank=True, > help_text=_("Optional")) >slug =

Re: Getting lists/dictionaries out of the database

2008-10-18 Thread Eric Abrahamsen
ould be possible, shouldn't it? E > > > OTOH, pickling will be more compact, and safer, depending on how you > reconstitute it... > > --Ned. > http://nedbatchelder.com > > Eric Abrahamsen wrote: >> >> On Oct 18, 2008, at 4:38 AM, timc3 wrote: >> >&g

Re: ViewDoesNotExist No module. where is it being called, I don't want it to.

2008-10-17 Thread Eric Abrahamsen
On Oct 18, 2008, at 3:42 AM, KillaBee wrote: > > I keep getting this error that says ViewDoesNotExist: Could not > import intranet.timesheets.views. Error was: No module named User. No > i do not have a User module, I don't want nor need one. How do I find > out Where it is being call at? I

Re: Getting lists/dictionaries out of the database

2008-10-17 Thread Eric Abrahamsen
On Oct 18, 2008, at 4:38 AM, timc3 wrote: > > Thanks for the help. Yeah, my terminology is quite often wrong, to > much context switching with other things. > > Unfortunately I am never sure what will go in to that field, just data > that's sourced from various types of media, and populated

Re: Why cannot get a hidden input value by POST method?

2008-10-10 Thread Eric Abrahamsen
On Oct 10, 2008, at 5:14 PM, GAEFans wrote: > > OS: windows XP > SDK: Google App Engine 1.1.3 (Django / 0.96.1) > > template snippets: > ... > > > > You've got "value" misspelled for these two fields, correct that and try again... E > > > > E-mail: > >

Re: Extend contrib.comments?

2008-10-08 Thread Eric Abrahamsen
esolved, > the proper way to do this will be to create your own app with a > get_form() function in __init__.py, and then set COMMENTS_APP to point > to your app. Thanks for the head's up, Carl, I'll keep an eye on the ticket. E > > On Oct 7, 7:49 pm, Eric Abrahamsen <[EMA

Re: Extend contrib.comments?

2008-10-07 Thread Eric Abrahamsen
On Oct 7, 2008, at 11:38 PM, fitzage wrote: > > I want to add one additional piece of data to the comment form. > Basically a checkbox that says whether or not the commenter wants to > be notified of followup comments. I just did exactly this, and found that what works best is not just to

Re: 'next' value in comment post/preview

2008-10-03 Thread Eric Abrahamsen
On Sep 23, 11:07 am, Eric Abrahamsen <[EMAIL PROTECTED]> wrote: > Somewhat pursuant to this > thread:http://groups.google.com/group/django-users/browse_thread/thread/a0c4... > > a hidden 'next' field in the comment post form doesn't get carried   > over to the comment p

'next' value in comment post/preview

2008-09-22 Thread Eric Abrahamsen
Somewhat pursuant to this thread: http://groups.google.com/group/django-users/browse_thread/thread/a0c468f0c81bb197# a hidden 'next' field in the comment post form doesn't get carried over to the comment preview view. It seems like if you're going to have a manual 'next' value possible in

Re: Error: No module named X (django standalone script)

2008-09-17 Thread Eric Abrahamsen
On Sep 17, 2008, at 11:45 PM, Mathieu Leplatre wrote: > > Hi all, > > I am starting a new thread, the first one became off-topic (http:// > groups.google.com/group/django-users/browse_thread/thread/ > 34b501d2d1f88496/f8a5d5ef5aeab62a) > > I want to do a simple external script that just relies

Re: akismet and the new comments app

2008-09-13 Thread Eric Abrahamsen
On Sep 13, 2008, at 12:46 PM, Thejaswi Puthraya wrote: > > On Sep 12, 7:09 pm, Eric Abrahamsen <[EMAIL PROTECTED]> wrote: >> Has anyone tried using akismet with the new comments contrib app? >> I've >> set up a signal handler to run on 'comment_will_be_po

Re: Using slug in comments urls

2008-09-12 Thread Eric Abrahamsen
On Sep 13, 2008, at 8:32 AM, Shantp wrote: > > Hi, > > I did a lot of searching on this and can't figure out what I'm doing > wrong. Here's what's in my urls.py: > > share_detail = { > 'queryset': Share.objects.all(), > } > > (r'^comments/', include('django.contrib.comments.urls')), >

akismet and the new comments app

2008-09-12 Thread Eric Abrahamsen
Has anyone tried using akismet with the new comments contrib app? I've set up a signal handler to run on 'comment_will_be_posted' and check the comment with akismet, and the service is insisting my test comments are spam no matter what. I'm using the voidspace python akismet API, and

Re: comparing Model instances

2008-09-11 Thread Eric Abrahamsen
On Sep 12, 2008, at 6:05 AM, Malcolm Tredinnick wrote: > > > On Thu, 2008-09-11 at 17:27 -0400, Steve Holden wrote: > [...] >> I've got some timings lying around somewhere that clearly show the >> decorate/sort/undecorate implementation is way faster under normal >> circumstances. > > True.

comparing Model instances

2008-09-11 Thread Eric Abrahamsen
I'm fooling around with comparing instances of different models, trying to make a unified stream of instances that can be sorted by date according to a certain datetime attribute on each model. I thought I'd define a __cmp__ method on each model in question, that would provide the

Re: Custom manager for many-to-many traversal

2008-09-01 Thread Eric Abrahamsen
ight be able to help with the next step... Yours, Eric > I tried to figure these things out on my own, but I just couldn't wrap > my head around it. > > On Aug 26, 2:32 am, Eric Abrahamsen <[EMAIL PROTECTED]> wrote: >> On Aug 26, 2008, at 5:00 PM,MrJogowrote: >> >

Re: Custom manager for many-to-many traversal

2008-08-26 Thread Eric Abrahamsen
ay no more... E > > > On Aug 26, 2:10 am, Eric Abrahamsen <[EMAIL PROTECTED]> wrote: >> On Aug 25, 2008, at 3:11 PM,MrJogowrote: >> >> >> >> >> >>> How do I create a custom manager for many-to-many traversal? An >>> example will

Re: Custom manager for many-to-many traversal

2008-08-26 Thread Eric Abrahamsen
On Aug 25, 2008, at 3:11 PM, MrJogo wrote: > > How do I create a custom manager for many-to-many traversal? An > example will illustrate what I want to do better. Suppose I have the > following models.py: > > class Book(models.Model): > title = models.CharField(max_length=100) > > class

Re: Combining feeds

2008-08-22 Thread Eric Abrahamsen
Hey Eric, I've done this with two different models, the main trick was in the Feed class's items() method. What I'm doing is a little ugly: calling list() on the two querysets, appending one list to the other, then sorting the result using a function that determines which date attribute

Re: Django Page - Db Connections count

2008-07-22 Thread Eric Abrahamsen
You could try the debug middleware: http://www.djangosnippets.org/snippets/766/ or the page stats middleware: http://code.djangoproject.com/wiki/PageStatsMiddleware and this article by Simon Willison is a good general resource: http://simonwillison.net/2008/May/22/debugging/ Yours, Eric On

Re: superuser has no rights with newforms admin

2008-07-19 Thread Eric Abrahamsen
> I've tried alternating between using admin.autodiscover() in my > urls.py, and manually registering my models using > admin.site.register(Person), but I still get the permission error in > the admin site. I've also tried flushing the database, but that > doesn't seem to solve anything. FWIW, my

Re: newforms-admin branch has been merged into trunk

2008-07-18 Thread Eric Abrahamsen
Beers all around! On Jul 19, 2008, at 8:01 AM, Brian Rosner wrote: > > I have just recently merged the newforms-admin branch into trunk as of > r7967 [1]. This is an extremely backward incompatible change. The > entire admin application in contrib has been refactored. The newforms > module has

Re: multiple one-to-one relationships

2008-07-16 Thread Eric Abrahamsen
> As documented in the backwards-incompatibility notes from the > queryset-refactor merge, OneToOneFields in (existing) admin are not > supported. They didn't work before the qsrf merge reliably, either, so > no functionality was lost in the process. Sweet, I'm switching to nf-ad. Thanks a lot.

Re: multiple one-to-one relationships

2008-07-16 Thread Eric Abrahamsen
> Saving how, exactly? If admin, newforms-admin or old admin? If old > admin, have you tried it on newforms-admin -- bugs in old admin are > unlikely to get any attention at this point. If saving in your own > code, more details of that code would help. > This is saving through the old

multiple one-to-one relationships

2008-07-16 Thread Eric Abrahamsen
I've got an issue with multiple one-to-one relationships, which probably arises from poor design decisions on my part. Given a model like the following: class Translator(models.Model): user = models.OneToOneField(User, unique=True, blank=True, null=True, help_text="If this translator

Re: capture http code 413 (file size too large)

2008-07-16 Thread Eric Abrahamsen
If you wanted to do this purely within django, you could write a custom middleware that reads a 'request body max size' setting from settings.py, then checks the content-length header on incoming request against that setting and returns a custom 413 if it's too large. I believe that doing

Re: Request object in template HTML

2008-07-15 Thread Eric Abrahamsen
On Jul 15, 2008, at 9:55 PM, Nazmi ZORLU wrote: > Hi, > > I wonder if I can access request object in html template or absolute > page url that currently rendering. If you're not using generic views, you can pass "context_instance=RequestContext(request)" as a third argument to

Re: cant access non-django web page after deploy django on localhost

2008-07-15 Thread Eric Abrahamsen
On Jul 15, 2008, at 3:15 PM, Evert wrote: > >> I deployed my Django Application onto the localhost using Apache. >> Below are the changes i did in the httpd.conf >> >> >>ServerName localhost >>SetHandler python-program >>PythonHandler django.core.handlers.modpython >>

Re: CSV updater, 2 saves in one function. Problem?

2008-07-10 Thread Eric Abrahamsen
>> print p.sku, p.items_in_stock >> #Returned only the last line >> BWC300SS 22 >> >> I don't get it why it didn't return the full excel feed again. When in doubt, throw more print statement in! Try putting one after this line: p = Product.objects.get(sku=update_sku) To make sure you're

Re: Automatic Image Resizing upon Upload

2008-07-10 Thread Eric Abrahamsen
It's intensive, but not prohibitively so. I've used a few setups where large image files were uploaded and, depending on the options, two or even three different versions of the image are created in the save() method. The server has yet to explode. Try poking through some of these

Re: URLs rewrite

2008-07-09 Thread Eric Abrahamsen
> Mod rewrite will be faster and more efficient. Not to mention, it > takes some complexity out of your project. Granted that's true, I wonder if contrib.redirects would be more effective if it used regexs. Particularly for old-site to new-site conversions, one-to-one redirects aren't

Re: Error in URL configuration

2008-07-07 Thread Eric Abrahamsen
Hi Leaf, The error message you want is the one just below the one you cited in your email. Namely this: Exception Value: Error while importing URLconf 'dj_styles.urls': No module named details.urls.default If you look in your dj_styles/urls.py, it looks like you've got this line: from

Re: home page

2008-07-06 Thread Eric Abrahamsen
Hey Dave, Your homepage, or index view, is nothing more than a (r'^$', 'index',) entry in your urlconfs, and an 'index' view somewhere in your codebase (obviously it doesn't have to be called index). While I've got several apps tied together for any one site, there's usually one app that's

Re: handling currency values

2008-07-06 Thread Eric Abrahamsen
Scratch the locale-dependent idea, of course, but still... On Jul 6, 1:05 pm, Eric Abrahamsen <[EMAIL PROTECTED]> wrote: > Is this something that might belong in the humanize filters package?   > Either something like {{ quantity|currency }}, which takes the   > currency t

Re: handling currency values

2008-07-05 Thread Eric Abrahamsen
Is this something that might belong in the humanize filters package? Either something like {{ quantity|currency }}, which takes the currency type from locale, if in use, or else explicitly with {{ quantity|currency:"USD" }}? It's not a great savings over just doing it from scratch, but

Re: Django Apps

2008-06-28 Thread Eric Abrahamsen
You can try google code projects: http://code.google.com/hosting/search?q=django=Search+Projects many of the most often-used public apps are hosted there. There's also http://djangosearch.com, though I haven't used that much... Happy hunting, E On Jun 28, 2008, at 5:58 PM, keegan3d wrote: >

Re: Django Database Relationship Question

2008-06-26 Thread Eric Abrahamsen
You'd almost think they were handing out prizes for being quickest on the draw :) On Jun 27, 2008, at 12:18 PM, joshuajonah wrote: > > And this is why the Django community rocks, two examples and a full > explaination with a link in less than 10 minutes, GW guys > > On Jun 26, 11:55 pm,

Re: Django Database Relationship Question

2008-06-26 Thread Eric Abrahamsen
Hey there, A M2M field creates an intermediary join table which doesn't show up in the admin, or other places. It's basically just a pairing of Journalist ids with Article ids, and the M2M field is a convenience that allows you to ignore this table. If you want to add additional

Re: base template and views

2008-06-26 Thread Eric Abrahamsen
Probably what you want is to make a custom template tag that does the proper query-to-html business, and then stick that tag in your base template. Might want to look into caching the result, if it doesn't change often...

Re: How do I add the user ID to a template?

2008-06-24 Thread Eric Abrahamsen
If you do go the RequestContext route, you can wrap the standard render_to_response function in a custom render function that adds the RequestContext automatically, as per here: http://www.djangosnippets.org/snippets/3/ and then use the custom function in your views, instead of

Re: Django users in Vietnam?

2008-06-24 Thread Eric Abrahamsen
Aha! So it's you behind the City Weekend website! I always wondered who did that. On Jun 24, 2008, at 3:31 PM, Collin wrote: > > I've been working w/ Django on a project in China for the last four > years at www.exoweb.net and www.ringier.ch. I love it. Now, I'm > responsible for helping

Re: Where to install additional libraries?

2008-06-23 Thread Eric Abrahamsen
It may very well make a difference if you're using python2.4 and you install packages in a python2.5 site-packages directory! I remember reading somewhere that that was one of the issues of doing a Leopard upgrade, versus wiping the drive and doing a full install. I did the latter, and I

Re: How to execute method in template?

2008-06-21 Thread Eric Abrahamsen
On Jun 22, 2008, at 11:00 AM, Kenneth McDonald wrote: > > Notice the call on "greeting.key()". However, unless I'm missing > something, there is no way to actually invoke a method from within a > Django template. Hi Kenneth, Leaving the parentheses off after greeting.key will actually result in

Re: Use new variables on templates

2008-06-15 Thread Eric Abrahamsen
Crap, I knew there was something a little off there. On Jun 16, 2008, at 12:50 AM, James Bennett wrote: > > On Sun, Jun 15, 2008 at 11:29 AM, Eric Abrahamsen <[EMAIL PROTECTED]> > wrote: >> One of the things django does for you is make 'settings' available >>

Re: Use new variables on templates

2008-06-15 Thread Eric Abrahamsen
One of the things django does for you is make 'settings' available everywhere. So if you want to use these constants in a template, you should be able to do this in a view: site_name = settings.SITE_NAME and then pass 'site_name' into a template. Sure hope that's correct... E On Jun 16,

Re: Untruncating a comment

2008-06-12 Thread Eric Abrahamsen
The __unicode__ method of Comments/FreeComments includes a truncated chunk of the comment text, is this what you mean? If you just output {{ comment }} into the template, you'll get something like "John Doe: What I think about this blog post is...". If you want the whole comment, you'll

to_python vs validate

2008-06-07 Thread Eric Abrahamsen
Hi there, I recently discovered that, when fooling with values in my model's custom save() method, I need to treat PositiveSmallIntegerField values as string values, rather than integer values. Googling led me to this thread on django-developers:

Re: forms - WTF

2008-06-05 Thread Eric Abrahamsen
One thing to note is that if your form is 'foo', calling foo.__str__(), foo.as_table() and print foo all do the same thing, ie the table output is the default __str__ output, and in your template, {{foo}} and {{foo.as_table}} will produce exactly the same HTML. Also, in Emily's view here,

Re: Custom CSS for newforms using ModelForm

2008-06-03 Thread Eric Abrahamsen
lds of this model? > > class Model_1Form(ModelForm): >class Meta: >model = Model_1 >exclude = ('hash') >def save(self, request): > something something > > Let me know if I missed something. > Thanks > > On Jun 3, 9:14 am, Eric Abrahamsen

Re: Custom CSS for newforms using ModelForm

2008-06-02 Thread Eric Abrahamsen
Hey there, You probably want this: http://www.djangoproject.com/documentation/newforms/#customizing-widget-instances You'll have to specify the field types for your model, then widget types for each field, and the extra attributes go in the widget. Yrs, E On Jun 3, 2008, at 2:23 AM, Mayank

Re: newforms

2008-06-02 Thread Eric Abrahamsen
Hi Bobby, you're best off going through the tutorial in the online docs, that has a basic explanation of how views made, and how you can render a template with a given context. Try this bit in particular:

Re: Change the model name

2008-05-31 Thread Eric Abrahamsen
Are you maybe talking about changing the underlying database table name? http://www.djangoproject.com/documentation/model-api/#table-names On Jun 1, 2008, at 2:45 AM, Kless wrote: > > Is possible to change the model name? > > From a class as *class FooBar* > it's got a model called *foobar*,

Re: WebFaction memories

2008-05-29 Thread Eric Abrahamsen
A single django app running under mod_python seems to use about 20-30MB of memory no matter what, but I think that number holds pretty steady unless you're really getting a lot of traffic (and memcached will save your life no matter what). I'm running several small- to medium-sized sites

Re: list index out or range,getting rss feed urls out of db

2008-05-29 Thread Eric Abrahamsen
anymore. E On May 29, 2008, at 5:08 PM, sebastian stephenson wrote: > > well umm. can I add urls though the admin interface? > On 28 May 2008, at 19:42, Eric Abrahamsen wrote: > >> >> What I was originally suggesting you do (which of course might not >> turn out t

Re: list index out or range,getting rss feed urls out of db

2008-05-28 Thread Eric Abrahamsen
What I was originally suggesting you do (which of course might not turn out to be the best solution) is use feedparser to read feed urls, and save those feeds into your database. That way, you wouldn't be using feedparser at all in your views, just regular database queries. If your models

Re: Many to Many field and the template

2008-05-25 Thread Eric Abrahamsen
Double curly brackets {{ }} are used for variable substitution. These brackets: {% %} are used for template tags, of which the for loop is one. So you want: {% for et in entity.entity_type.all %} Yours, Eric On May 25, 2008, at 6:59 PM, M.Ganesh wrote: > > Hi All, > > Unable to find a

Re: Authenticated user from models.py

2008-05-23 Thread Eric Abrahamsen
Of course... That was a dumb question. On May 24, 2008, at 5:16 AM, [EMAIL PROTECTED] wrote: > > We have groups and permissions because the User model is meant for all > users, not just trusted users. > > On May 23, 3:49 pm, "Patrick J. Anderson" <[EMAIL PROTECTED]> > wrote: >> On Thu, 22 May

Re: Authenticated user from models.py

2008-05-22 Thread Eric Abrahamsen
On May 23, 2008, at 11:20 AM, [EMAIL PROTECTED] wrote: > > I find the "They're trusted, so let them enter it themselves" argument > frustrating. Not to mention: if they're trusted, then why do we have groups and permissions? > > > As someone above said, we're dealing with sites that

Re: ugly ugly SQL

2008-05-22 Thread Eric Abrahamsen
On May 23, 2008, at 12:27 AM, jonknee wrote: > > On May 22, 11:08 am, Eric Abrahamsen <[EMAIL PROTECTED]> wrote: > >> I tried using select_related('categories') on the original book >> query, >> but that seemed to actually slow it down. Are there a

ugly ugly SQL

2008-05-22 Thread Eric Abrahamsen
I saw Simon's debug footer middleware (http://www.djangosnippets.org/snippets/766/ ) come through the pipeline, and decided I'd give it a whirl, and I'm now considering a career in gardening. I have some views I knew were slow, and hit the database hard, but looking at the actual queries

Re: Django blogging engine - database structure question

2008-05-22 Thread Eric Abrahamsen
I don't know what the standard is, but I'm doing exactly what you detail here: two DB fields, one that stores Markdown text, and another, not visible in the Admin interface, that stores HTML. In the save method, one gets dumped into the other, via the markdown filter. If you or one of

Re: load external xml and css with varibles?

2008-05-22 Thread Eric Abrahamsen
iews, etc. > > > On May 22, 3:48 am, Eric Abrahamsen <[EMAIL PROTECTED]> wrote: >> On May 22, 2008, at 5:15 AM, sebey wrote: >> >>> that script you told me to do how do i get it running though the >>> admin >>> interface? >> >> It's not goin

Re: load external xml and css with varibles?

2008-05-21 Thread Eric Abrahamsen
script in place and set up a cron job. > > > On May 21, 4:25 pm, Eric Abrahamsen <[EMAIL PROTECTED]> wrote: >> On May 21, 2008, at 11:07 PM, sebey wrote: >> >> >> >>>> Use Feedparser (http://www.feedparser.org/) in a stand-alone >>>>

Re: load external xml and css with varibles?

2008-05-21 Thread Eric Abrahamsen
tup_environ(settings) Then you'll be able to import your feed models, create new instances, and save them, all within this script. Next, Google for how to set up a cron job, read the feedparser documentation for how to use feedparser, and you're good to go! E > > On May 21, 12:12 pm

Re: How to deal with "IndentationError"

2008-05-19 Thread Eric Abrahamsen
Also, this can often mean that you've inadvertently mixed tabs and spaces. If there's no obvious indentation error, check to see if your text editor or whatever has a 'cleanup' command, or a tabs-to-spaces/ spaces-to-tabs command. Running that often clears up these glitches. That's a heck

Re: How to achieve a function in template to show "Some hours ago"?

2008-05-19 Thread Eric Abrahamsen
This: http://www.djangoproject.com/documentation/templates/#timesince and the one right under it. E On May 19, 2008, at 3:24 PM, ERic ZoU wrote: > > Hi all, > > I have blog system that require a function that to show the hours/mins > before/ago for the last post. Any way to solve it? > >

Re: problem with DateQuerySet

2008-05-14 Thread Eric Abrahamsen
ne # returns None if s is null ValueError: invalid literal for int() with base 10: 'None' On May 14, 2008, at 3:30 PM, Adi Jörg Sieker wrote: > Hi Eric, > > On 14.05.2008, at 03:49, Eric Abrahamsen wrote: > >> app_years = Appearance.objects.dates('app_date','year') >

Re: problem with DateQuerySet

2008-05-14 Thread Eric Abrahamsen
self): return "%s: %s/%s, %s" % (self.venue, self.app_date.month, self.app_date.day,self.app_date.year) def get_absolute_url(self): return "/appearances/%s/#%s" % (self.app_date.year, self.pk) On May 14, 2008, at 3:30 PM, Adi Jörg Sieker wrote: > Hi

problem with DateQuerySet

2008-05-13 Thread Eric Abrahamsen
I've got a perplexing problem that I don't even know where to start fixing. Creating a DateQuerySet for one of my models produces an empty list every time. Here's at the prompt: >>> apps = Appearance.objects.all() >>> for ap in apps: ... print ap.app_date ... 2009-02-11 09:00:00

Re: Group by for querysets

2008-05-09 Thread Eric Abrahamsen
> Awesome! Thanks much, Eric! My pleasure... Just noticed there's a typo in the second part, should be columns.setdefault..., not blocks. Hooray for native group_by support in the ORM! I didn't realize that was already in there. --~--~-~--~~~---~--~~ You received

Re: Group by for querysets

2008-05-09 Thread Eric Abrahamsen
> This sounds like it might do what I need... Care to share a code > example? > > > Greg (Don't forget to reply to the list...) The documentation for the groupby function is notoriously obscure, but it's actually simple to use. It generates pairs where the first item is the common key for

Re: Group by for querysets

2008-05-09 Thread Eric Abrahamsen
In the meantime, you can use the groupby template tag for simple grouping operations in the template, or else I've had success using the itertools.groupby function in the view, and then passing your queryset as a dictionary or list of tuples to the template. It will be nice to have native

Re: Traversing a backward relationship

2008-05-07 Thread Eric Abrahamsen
I've been using something like: City.objects.filter(jobs__isnull=True) It seems to work, but I'd really like to know if this is undesirable for any reason. On May 6, 2008, at 8:05 PM, Dmitriy Kurilov wrote: > > Hi. > > # models > > class City(models.Model): ># Fields... > > class

Re: Queryset-refactor branch has been merged into trunk

2008-04-26 Thread Eric Abrahamsen
Mmmm... model inheritance... multiple OneToOne fields mmm Thanks for all your hard work, Malcolm! Beers are owed to you! On Apr 26, 2008, at 8:30 PM, Prairie Dogg wrote: > > Malcolm: Sorry - it's late over here, didn't mean to mis-type your > name. > > File this and previous under:

Re: GenericRelation error

2008-04-25 Thread Eric Abrahamsen
>> When I try to view an Entry object in the admin, it gives me a >> KeyError, saying "Could not find Formfield or InlineObjectCollection >> named 'series'". I don't really know what this means... > > It means that generic relations are not supported in the admin > interface. You can't use them

GenericRelation error

2008-04-24 Thread Eric Abrahamsen
I'm trying to implement a very basic tagging function using generic relations, and running into errors I don't understand. The basic setup is, I've got a model called Series, and series should be linkable to many models via a SeriesItem model. Following the instructions here:

Re: Setting up get_absolute_url with a generic view

2008-04-20 Thread Eric Abrahamsen
Whoops, sorry, that was bad advice, please ignore! On Apr 20, 2008, at 5:19 AM, Matt wrote: > > I'm trying to get the following get_absolute_url function working in > one of my models: > > >def get_absolute_url(self): >

Re: Setting up get_absolute_url with a generic view

2008-04-20 Thread Eric Abrahamsen
Matt, You're using get_absolute_url to return an actual view – it's only meant to return a string representing the the URL for that model instance. The generic view information goes in your URL config file only, and get_absolute_url should return a URL that is matched by one of the

Re: Looping....

2008-04-18 Thread Eric Abrahamsen
I think what people are saying here is that your number, the iteration limit, has to be coming from somewhere or something. Chances are, that something is an iterable, or can be made into an iterable very easily, and thus can be used in a for loop. Where is the number coming from? On Apr

Re: Per user settings and records in the admin views

2008-04-15 Thread Eric Abrahamsen
There's a branch of Django called NewForms Admin (http://code.djangoproject.com/wiki/NewformsAdminBranch ) which will make it much easier to do what you're trying to do. From murmurings on this list it seems that branch will be merged into trunk before too long (in fact, there's a distinct

Re: Another Cycle Tag Question

2008-04-09 Thread Eric Abrahamsen
Hmm, you've got me there! I looked at the source but I'm afraid my eyes crossed halfway through. Maybe someone else can help? On Apr 8, 2008, at 12:57 AM, Kevin Monceaux wrote: > > > On Tue, 8 Apr 2008, Eric Abrahamsen wrote: > >> You just want plain old {% resetcycl

Re: Another Cycle Tag Question

2008-04-07 Thread Eric Abrahamsen
> Thanks, that sounds like just what I'm looking for. However, I've > applied > the patch and added a {% resetcycle rowcolors %} tag to the end of my > include tag's template but it's not resetting the cycle var. I > deleted > the defaulttags.pyc file to make sure it got recompiled and also

Re: Another Cycle Tag Question

2008-04-07 Thread Eric Abrahamsen
Someone pointed me at this page, and I've been happily using the resetcyle tag ever since.. http://code.djangoproject.com/ticket/5908 On Apr 7, 2008, at 10:33 PM, Kevin Monceaux wrote: > > Django Fans, > > I have another cycle tag question. Is there any way to reset a > cycle tag >

Re: Serving binary files "through" django

2008-04-07 Thread Eric Abrahamsen
> 1. Frontend-Proxy and static file server (i.e. Nginx od lighttpd) >if URL matches local file or rule: serve it >else: request file from Backend-Server (i.e. Apache) > 2. Backend Server >handle urls as in urls.py or your resolving strategy and serve > dynamic Data accordingly. > > In

Re: Serving binary files "through" django

2008-04-05 Thread Eric Abrahamsen
Sorry, wrote too soon. http://tn123.ath.cx/mod_xsendfile/ Guess I'll have to serve the files from django's apache, not my other media server, but it seems like this will do it. E On Apr 6, 12:25 pm, Eric Abrahamsen <[EMAIL PROTECTED]> wrote: > > If you are using Apache

Re: Serving binary files "through" django

2008-04-05 Thread Eric Abrahamsen
> If you are using Apache or lighttpd as a frontend-proxy you can use a > similar aproach with: X-Sendfile. I'd like to do something along these lines as well – keep files in a protected directory and only allow them to be served if Django says so. I'm serving static media from a different

Re: Memory Usage/Optimization Question

2008-04-05 Thread Eric Abrahamsen
Also, if you haven't already, I'd definitely recommend switching to mod_wsgi. I'm in the same boat as you – django apps on webfaction, running up against memory limits (to the point where I was getting my sites shut down); I started using mod_wsgi recently and haven't had any trouble

Re: more study case on django

2008-03-31 Thread Eric Abrahamsen
You can start with the www.djangoproject.com website itself! http://code.djangoproject.com/browser/djangoproject.com Eric On Mar 31, 2008, at 4:37 PM, Marco wrote: > > Hi, all > > I'm a beginner on Django. I wanna know are there some studycase > website core for learning? > > Thank you! >

Re: add comments to entry & link models

2008-03-09 Thread Eric Abrahamsen
> > If I create a comment model with my desired fields, can I use that > comment model with the entry and Link models. Note I am using generic > views for my blog app. > > > > On Mar 9, 7:15 pm, Eric Abrahamsen <[EMAIL PROTECTED]> wrote: >>> I tried this b

Re: add comments to entry & link models

2008-03-09 Thread Eric Abrahamsen
> I tried this but I have some problem with the preview template > There are errors showing up in the freepreview.html > I dont prefer to preview the comment. I like to get it posted and also > I want to include markdown syntax... This part of the page:

Re: image dimensions

2008-03-07 Thread Eric Abrahamsen
I solved this by deleting all my Pic objects and re-entering them into the database. I have no idea what was going on. On Mar 7, 9:39 am, Eric Abrahamsen <[EMAIL PROTECTED]> wrote: > I've become unable to use the get_IMAGEFIELD_dimensions() set of   > methods on images rec

image dimensions

2008-03-06 Thread Eric Abrahamsen
I've become unable to use the get_IMAGEFIELD_dimensions() set of methods on images recently: using pic.get_picFile_width() (where picFile is my model's ImageField) returns this traceback: File "/Library/Python/2.5/site-packages/django/utils/ functional.py", line 55, in _curried

Re: loading fixtures for test suite

2008-03-06 Thread Eric Abrahamsen
Gah TEST_DATABASE_CHARSET Sorry. E On Mar 6, 11:44 pm, Eric Abrahamsen <[EMAIL PROTECTED]> wrote: > I'm loading fixtures as part of a test suite, and finding that using > manage.py loaddata directly produces different results than using the > fixtures attribute of dj

loading fixtures for test suite

2008-03-06 Thread Eric Abrahamsen
I'm loading fixtures as part of a test suite, and finding that using manage.py loaddata directly produces different results than using the fixtures attribute of django's TestCase. Namely, Chinese characters in my database get interpreted correctly using loaddata, but running the tests

Re: Django on a non root Apache URL

2008-02-18 Thread Eric Abrahamsen
On Feb 18, 2008, at 11:09 PM, [EMAIL PROTECTED] wrote: > > Hi, > > that won't do it when I do something like: > return HttpResponseRedirect('/') > > What I want is to be able to do the command above and I'll get to the: > http://localhost/django > > Instead of http://localhost/ . > > > Is there

<    1   2   3   >