Re: Can't make ManyToMany form fields hidden

2015-03-06 Thread Eric Abrahamsen
Collin Anderson <cmawebs...@gmail.com> writes: > https://code.djangoproject.com/ticket/24453 For posterity: I should have been using a forms.MultipleHiddenInput widget for the ManyToManyField, rather than a plain old forms.HiddenInput. > On Wednesday, March 4, 2015 at 12:40:40 AM

Can't make ManyToMany form fields hidden

2015-03-03 Thread Eric Abrahamsen
Hi, I'm making some heavily customized model formsets, to encourage my users to input data. Mostly that involves cutting down the number of huge drop-down menus they have to go surfing through. So I have a model like this: class Work(models.Model): authors =

Re: read GET and POST simultaneously?

2015-01-27 Thread Eric Abrahamsen
is reliable behavior across browsers? > > Yes. > >> Is it a dumb idea for reasons I haven't thought of? > > No. Thank you very much! > Cheers, > > Tom > > On Tuesday, 27 January 2015 03:26:52 UTC, Eric Abrahamsen wrote: > > As far as I can tell (tes

read GET and POST simultaneously?

2015-01-26 Thread Eric Abrahamsen
As far as I can tell (testing with the Conkeror web browser), it's possible to read both GET and POST at once: if a user POSTs to a URL containing GET parameters, you can get them both in the view. Is this reliable behavior across browsers? Is it a dumb idea for reasons I haven't thought of? A

Re: Handle multiple modelforms in one html form

2015-01-17 Thread Eric Abrahamsen
Kakar Nyori writes: > When doing so, only the last pform is gets saved. And the other two > pforms are ignored. How do I get to save all the three forms of photo > (pforms) accordingly? > > Or is there any other way around? Your help will be much appreciated! > Thank you.

Re: another CSRF question -- and django hitcount

2014-12-06 Thread Eric Abrahamsen
Eric Abrahamsen <gir...@gmail.com> writes: Apologies for the very stupid posting below! I did my homework, and actually used the JQuery ajax function, like I was supposed to. Incidentally, I also had the "async" keyword on the tag in the head that loaded jquery, and that a

another CSRF question -- and django hitcount

2014-12-06 Thread Eric Abrahamsen
I have a question about the django-hitcount app that I think is likely csrf-related. I recently upgraded a site from Django 1.4 all the way to 1.7. I've got most everything working fine, except that the hitcount app I've been using[1], stopped recording hits. Nevermind the actual app, it works

Re: defining an app stub using AppConfig?

2014-11-30 Thread Eric Abrahamsen
the easier way to go would be to fork the app, then experiment with switching code in the app itself, rather than switching apps in my Django project. Whether or not that will actually turn out to be simpler... > On Tuesday, November 25, 2014 1:50:40 AM UTC-5, Eric Abrahamsen wrote: > > I'm mes

defining an app stub using AppConfig?

2014-11-24 Thread Eric Abrahamsen
I'm messing around with testing many Github forks of the emencia newsletter app, looking for one I like. In the meantime (and as I'm likely to continue switching around for a while), I'd like not to have to commit code that points at the different names of the different apps: they all have the

Weird permissions issue

2011-03-12 Thread Eric Abrahamsen
I'm using the emencia newsletter, and things are essentially fine, except that I've run into a very strange permissions issue in the admin backend. I have my regular user login, and the superuser. I've given my regular user all permissions for all newsletter models, and yet some of the inter-modal

Re: Can't create super user

2011-03-05 Thread Eric Abrahamsen
On Sat, Mar 05 2011, royy wrote: > Hello. > > I can't create a superuser for an admin area, i type username and e- > mail, then when I try to type password the keyboard freezes and > doesn't respond so I need to use the Ctrl + break to quit server (I'm > following the steps for writing my first

Re: AW: parameter, but not in the URL

2011-03-04 Thread Eric Abrahamsen
-Ursprüngliche Nachricht- > > Von: django-users@googlegroups.com [mailto:django-users@googlegroups.com] Im > Auftrag von Eric Abrahamsen > Gesendet: Freitag, 04. März 2011 10:46 > An: django-users@googlegroups.com > Betreff: Re: parameter, but not in the URL > > On Fr

Re: parameter, but not in the URL

2011-03-04 Thread Eric Abrahamsen
On Fri, Mar 04 2011, Szabo, Patrick (LNG-VIE) wrote: > 127.0.0.1:800/93/1 > > > > This would delete an object with the id 93. > > This is very unsecure and once the user notices how this works he > could delete any object he wants. > > > > How can i make this more secure ?! There's pretty

weird permissions issue

2011-03-02 Thread Eric Abrahamsen
I'm using the emencia newsletter, and things are essentially fine, except that I've run into a very strange permissions issue in the admin backend. I have my regular user login, and the superuser. I've given my regular user all permissions for all newsletter models, and yet some of the inter-modal

mapping django import tree?

2010-03-28 Thread Eric Abrahamsen
It was only recently that I finally learned how Etags work in Emacs and made myself a tags file for Django's source code -- now that I'm 4/5 of the way to pure programming leisure I can't rest until the laziness is complete. That means making a programmatic map of django class/function import

Re: Difference between request.POST.get('foo') and request.POST['foo']?

2010-03-24 Thread Eric Abrahamsen
On Tue, 2010-03-23 at 23:14 -0700, Daniel wrote: > Hi, > > Are these statements equivalent? I want to say no, but I can't see > why. Nope. If the key 'foo' doesn't exist, request.POST.get('foo') will return None, while request.POST['foo'] will blow up with a KeyError. Using the get() method on

Re: Scope of an app

2010-02-18 Thread Eric Abrahamsen
On Feb 18, 2010, at 9:41 PM, Sander wrote: Thanks! Those guidelines are certeinly helpfull. Hope these helps. If you need more specific answers please expand the following paragraph: My main project should have a couple of entities, like for example an 'Employee', 'Manager', 'Question'.

Re: Next previous links from a query set / generi views

2010-02-07 Thread Eric Abrahamsen
On Feb 8, 2010, at 7:56 AM, eaman wrote: I'm up to code those two methods... If some one is interested in this thread I managed to code these two methods: get_next | get_prev in order to get a previous or next item in a set right from my model: - http://dpaste.com/155961/ Now that you've

Re: Next previous links from a query set / generi views

2010-02-07 Thread Eric Abrahamsen
On Feb 7, 2010, at 8:54 PM, eaman wrote: On Feb 7, 3:24 am, Eric Abrahamsen <gir...@gmail.com> wrote: Yup, if you have non-null date/datetime fields on your model, each model will automatically get "get_next_by_FOO" and "get_previous_by_FOO" methods, where FOO i

Re: Next previous links from a query set / generi views

2010-02-06 Thread Eric Abrahamsen
Yup, if you have non-null date/datetime fields on your model, each model will automatically get "get_next_by_FOO" and "get_previous_by_FOO" methods, where FOO is the name of the datetime field:

Custom comment app and tables

2010-02-03 Thread Eric Abrahamsen
Over the course of a year or two of manual database twiddling, I've fairly well messed up my table indexes and whatnot. In particular, I'm getting lots of "duplicate key names" when installing fixtures for testing, and generic foreign keys that point at contenttypes that no longer exist.

Re: Using a template variable in the "include" template tag

2010-01-29 Thread Eric Abrahamsen
already got a Content superclass going you could probably do some metaclass jiggery-pokery to make this automatic for subclasses �C on reflection it wouldn't be as simple as I blithely suggested in my last response, but I think it could be done. E On Jan 30, 5:59 am, Eric Abrahamsen <

a hook where request is available

2010-01-29 Thread Eric Abrahamsen
I've got a "NewContent" model which is essentially a tumblelog – when instances of certain models are created or saved, a NewContent instance is created that keeps track of them, and NewContent querysets are used to populate the index page, RSS feed, etc. Up until now I've been doing this

Re: Using a template variable in the "include" template tag

2010-01-29 Thread Eric Abrahamsen
I've done this by including a python-only attribute on the models themselves: include_template = "content/post/include.html" and in the template {% include content.include_template %} Provided that "content" is a model instance. You could even write a model mixin class that does this

Re: why does if statement fail with

2010-01-07 Thread Eric Abrahamsen
On Jan 8, 2010, at 12:54 PM, Russell Keith-Magee wrote: On Fri, Jan 8, 2010 at 12:50 PM, Eric Abrahamsen <gir...@gmail.com> wrote: On Jan 8, 2010, at 12:28 PM, neridaj wrote: Can anyone tell me why this less than symbol is causing this if statement to fail? {% if page_obj.

Re: why does if statement fail with

2010-01-07 Thread Eric Abrahamsen
On Jan 8, 2010, at 12:28 PM, neridaj wrote: Can anyone tell me why this less than symbol is causing this if statement to fail? {% if page_obj.number|add:"4" < paginator.count %} {% endif %} Because the if tag doesn't accept comparison operators. If you're trying to make a

Re: debugging cache

2010-01-04 Thread Eric Abrahamsen
On Dec 24, 2009, at 10:28 PM, brook wrote: > > > On Dec 23, 5:13 am, Eric Abrahamsen <gir...@gmail.com> wrote: >> >> I'm using memcached with the cache_page decorator, and it simply >> wasn't caching >> views. > >> CACHE_MIDDLEWARE_KEY_PREFIX =

Re: debugging cache

2009-12-24 Thread Eric Abrahamsen
On Dec 24, 2009, at 1:57 AM, Peter Rowell wrote: >> CACHE_MIDDLEWARE_ANONYMOUS_ONLY = True > > I know this is a silly question, but have your tried this *as an > anonymous user*? I ask because it's easy to forget you are logged in. > When in doubt use something like Firefox's Web Developer

debugging cache

2009-12-22 Thread Eric Abrahamsen
Hi, I noticed a while ago that my cache wasn't doing anything – I'm using memcached with the cache_page decorator, and it simply wasn't caching views. I've verified that memcached is running, and my settings.py file is pointed at the right address. Here are my relevant settings:

Re: admin for "regular" users - still a bad idea?

2009-11-26 Thread Eric Abrahamsen
On Nov 27, 11:50 am, Count László de Almásy wrote: > ok, fair enough. does generic views have the machinery to replicate > the admin interface? Generic views take most of the pain out of CRUD, and also take care of producing and validating forms. You can also steal some of

Re: Is django comment's honeypot really useful?

2009-10-08 Thread Eric Abrahamsen
On Oct 8, 2009, at 8:20 PM, Joshua Partogi wrote: > >> even the developers who know what is happening shouldn't complain. >> >> I have a site that seems to get crawled by bots quite frequently. I >> had a >> feedback form that didn't have a honeypot originally. I got about >> 3-4 pieces >>

Leaking python app structure

2009-09-09 Thread Eric Abrahamsen
I have a site with SEND_BROKEN_LINK_EMAILS = True in the settings, which means I get both legitimate 404s and also probes where the bot is being clever by putting the fake URL in the referer heading. Today I got a series of 404 messages that were alarming because they were probing

Re: misunderstanding

2009-08-16 Thread Eric Abrahamsen
On Aug 17, 2009, at 9:33 AM, Mike Dewhirst wrote: > > There's something here I'm not seeing. If anyone can point out the > docco > which refers I would be most grateful ... I'm using py2.6 and Django > from svn head. > > The template below displays the title correctly but claims "No meta >

Re: slug regular expression: which should I use

2009-08-10 Thread Eric Abrahamsen
On Aug 10, 2009, at 1:56 PM, J0hnsmith wrote: > > Which should I use to match a slug made using slugify? > > (?P[a-zA-Z0-9-]+) > > or > > (?P[\w-]+) They're not exactly the same. Most of the time \w is alphanumeric (ie equivalent to your first regex) but Django compiles the RegexURLPattern

Re: how to deploy Django on the web server?

2009-08-08 Thread Eric Abrahamsen
On Aug 8, 2009, at 8:24 PM, justin jools wrote: > ok well thanks for your reply: > > first I have free access and they have told me python is installed > but it's not working as I ran a hello world test script which doesbt > execute. That is the first of my problems. > > My second problem is

Re: how to deploy Django on the web server?

2009-08-08 Thread Eric Abrahamsen
On Aug 8, 2009, at 5:14 PM, justin jools wrote: > Yes Ive read these docs and I understand certain script changes are > needed before running on the server but I want to know about: > > installing Django on the server, do i need to use telnet to do > this? or can i upload already executed

Re: [solved]Re: test if GET is "empty"

2009-07-29 Thread Eric Abrahamsen
On Jul 29, 2009, at 9:57 PM, Salvatore Leone wrote: > > >> Given the way boolean tests go in Python, you should just be able to >> test for the dictionary itself: >> >> if request.GET: >> >> else: >> >> >> E >> > > mmm I don't think so, I think request.GET is true even if the >

Re: [solved]Re: test if GET is "empty"

2009-07-29 Thread Eric Abrahamsen
On Jul 29, 2009, at 6:06 PM, Salvatore Leone wrote: > > I answer my self: > > all I need is to test the length of the dictionary. > > if request.method == "GET" and len(request.GET) != 0: Given the way boolean tests go in Python, you should just be able to test for the dictionary itself: if

Re: using modelformsets

2009-07-06 Thread Eric Abrahamsen
On Jul 5, 2009, at 11:32 PM, Matthias Kestenholz wrote: > > Hi, > > On Sun, Jul 5, 2009 at 11:42 PM, Eric Abrahamsen<gir...@gmail.com> > wrote: >> >> I'm somehow failing to use modelformsets, this is the relevant view >> and error traceback: >> &g

using modelformsets

2009-07-05 Thread Eric Abrahamsen
I'm somehow failing to use modelformsets, this is the relevant view and error traceback: http://dpaste.org/evHq/ I'm validating a whole bunch of forms at the same time, but I don't see how that could cause the formset failure. Sample is a model with a ForeignKey to Author (though the

Re: filtering on reverse foreignkey using isnull

2009-06-01 Thread Eric Abrahamsen
On Jun 2, 2009, at 2:07 AM, Karen Tracey wrote: > On Sun, May 31, 2009 at 11:40 PM, Eric Abrahamsen <gir...@gmail.com> > wrote: > > On May 31, 2009, at 11:45 PM, Karen Tracey wrote: > >> On Sun, May 31, 2009 at 10:13 AM, Eric Abrahamsen >> <gir...@gmail.

Re: filtering on reverse foreignkey using isnull

2009-05-31 Thread Eric Abrahamsen
On May 31, 2009, at 11:45 PM, Karen Tracey wrote: > On Sun, May 31, 2009 at 10:13 AM, Eric Abrahamsen <gir...@gmail.com> > wrote: > > Hi, > > I've got two models, Author and Entry, with a foreignkey from Entry to > Author. There are many Authors with no related en

filtering on reverse foreignkey using isnull

2009-05-31 Thread Eric Abrahamsen
Hi, I've got two models, Author and Entry, with a foreignkey from Entry to Author. There are many Authors with no related entries, and until recently I've been able to put this manager on the Author model to only select Authors with Entries: def contributors(): return

Re: How to use next with comments?

2009-05-31 Thread Eric Abrahamsen
On May 29, 2009, at 5:40 AM, Kevin Fullerton wrote: > > > On Thu, May 28, 2009 14:31, Eric Abrahamsen wrote: >> >> The default comment form does not include a next parameter, so if you >> don't override the builtin comment templates you won't get any next >> p

Re: How to use next with comments?

2009-05-28 Thread Eric Abrahamsen
On May 28, 2009, at 3:17 PM, Kevin Fullerton wrote: > > On Thu, May 28, 2009 01:50, Eric Abrahamsen wrote: >> >> On May 28, 2009, at 4:02 AM, Kevin Fullerton wrote: >> >>> >>> I'm working with django.contrib.comments at the moment, and so far &

Re: How to use next with comments?

2009-05-27 Thread Eric Abrahamsen
On May 28, 2009, at 4:02 AM, Kevin Fullerton wrote: > > I'm working with django.contrib.comments at the moment, and so far > most > things are working as expected. > > I'm building the submission form using {% get_comment_form for > object as > form %} and have added the following as part

Re: Rendering models using their own templates

2009-05-19 Thread Eric Abrahamsen
On May 20, 2009, at 10:53 AM, Roberto Cea wrote: > > I have a large amount of optional components (with a model for each > one) that will be freely inserted by my users, and it would be > impractical to render each one in a single large template. > I want to give each component a ".render()"

Re: please help me

2009-05-16 Thread Eric Abrahamsen
On May 17, 2009, at 1:26 AM, Apple wrote: > > I write some code like following: > > #coding=utf8 > from django.shortcuts import render_to_response > from django.http import *

Re: 'base' template

2009-05-09 Thread Eric Abrahamsen
jango version are you running, and how exactly are you running the development server. Yours, Eric > Lisa > > On Fri, May 8, 2009 at 11:10 PM, Eric Abrahamsen <gir...@gmail.com> > wrote: > > On May 9, 2009, at 2:37 AM, lisa holper wrote: > >> Hi, >> >&

Re: 'base' template

2009-05-08 Thread Eric Abrahamsen
-index But you should probably back up and start with the tutorial: http://docs.djangoproject.com/en/dev/intro/tutorial01/#intro-tutorial01 Eric > > Thanks, Lisa > > On Fri, May 8, 2009 at 5:57 AM, Eric Abrahamsen <gir...@gmail.com> > wrote: > > > On May 8,

Re: 'base' template

2009-05-08 Thread Eric Abrahamsen
On May 8, 2009, at 4:35 PM, lisa holper wrote: > Hi, > > I created a website with django. > My problem: When I insert all .html pages in my directory, I can see > the website but without using the 'base' template. Do you have {% extends 'base.html' %} at the top of all your templates? You

Re: Question regarding django.contrib.comments

2009-04-22 Thread Eric Abrahamsen
On Apr 18, 2009, at 6:03 PM, SoCow wrote: > > Hi there, > > I've implemented django.contrib.comments and activated the custom > redirect option by including the following line in the comments form: > > value="{{ object.get_absolute_url }}" /> > > This works great for redirecting back to the

custom comment app migration

2009-04-09 Thread Eric Abrahamsen
I'm planning on migrating an existing (django.contrib) comments setup into a custom comment app, and I'm wondering if anyone's got any experience to impart in this regard. I have done cross-app data migration before, and cocked it up horribly. These are the steps I'm considering; if

Re: redirect back after save

2009-03-28 Thread Eric Abrahamsen
On Mar 28, 2009, at 8:04 PM, Paddy Joy wrote: > > I have a form that can be called from multiple places. What's the best > way to redirect back to the original page after the form has been > saved. I think the standard way to do this is to include a hidden form element (usually called

Re: Design patterns for create/update view

2009-03-23 Thread Eric Abrahamsen
te url config lines for each model. The code lives in contrib/ admin/sites.py Is that what you meant? > > On Mar 23, 12:13 pm, Eric Abrahamsen <gir...@gmail.com> wrote: >> On Mar 23, 2009, at 6:06 PM, Lyubomir Petrov wrote: >> >> >> >>> Just wonderi

Re: Design patterns for create/update view

2009-03-23 Thread Eric Abrahamsen
On Mar 23, 2009, at 6:06 PM, Lyubomir Petrov wrote: > > Just wondering are there any docs/examples of design pattern with > django for creating a "create/update" view. These views are written for you! See the CRUD section of the Generic Views page:

Re: Need help with combined feed

2009-03-09 Thread Eric Abrahamsen
On Mar 10, 2009, at 12:43 AM, bax...@gretschpages.com wrote: > > 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 +"

Re: Overriding the HTML id in ModelForm

2009-03-05 Thread Eric Abrahamsen
On Mar 5, 2009, at 11:14 AM, Alex Gaynor wrote: > > On 3/4/09, Eric Abrahamsen <gir...@gmail.com> wrote: >> >> >> On Mar 5, 2009, at 8:05 AM, Romain wrote: >> >>> >>> Hello, >>> >>> On the same page I have 2 ModelForm

Re: Overriding the HTML id in ModelForm

2009-03-04 Thread Eric Abrahamsen
On Mar 5, 2009, at 8:05 AM, Romain wrote: > > Hello, > > On the same page I have 2 ModelForm that happen to have an attribute > with the same name. Is it possible to choose the name of the HTML id > generated by the form without having to change the real name of the > model attribute? A simple

Re: Sending a list of items by email

2009-03-03 Thread Eric Abrahamsen
On Mar 3, 2009, at 7:52 PM, Alfonso wrote: > > Thinking this should be easy but not sure of the correct path to > success! > > Got a simple filter queryset that pulls order products from a db: > > order_list = CustomerBasket.objects.all() > customer = UserProfile.objects.get(user=user).customer

Re: How to select a single field from database with django QuerySet API?

2009-02-26 Thread Eric Abrahamsen
On Feb 26, 2009, at 6:23 PM, marco sedda wrote: > > Hi, > I want to select a "single" field from a table, i've read the > QuerySet API reference but i can't find anything to solve my query. > > Just to explain: > > If i've a table like: > > User > first_name =

Re: Passing HTML Table to a Template

2009-02-26 Thread Eric Abrahamsen
On Feb 26, 2009, at 4:30 PM, tykun...@gmail.com wrote: > > Hi I am trying to pass an HTML table to a template and have it display > > Currently I have{{table1}} inside my template to mark the position > I wish to display the table > > In my views.py I havereturn

Re: Django

2009-02-19 Thread Eric Abrahamsen
On Feb 19, 2009, at 10:05 PM, Nalini wrote: > > While inputting an invalid username and password it should throw an > alert message saying "invalid user". How to get this in django? Do i > need to add something in views.py? It's hard to know exactly what you're doing here, but I'm going to

Re: Changing an ImageField file without re-upload

2009-02-16 Thread Eric Abrahamsen
On Feb 17, 2009, at 5:17 AM, Carmelly wrote: > > My situation is this: I want to allow my users to upload multiple > userpics and then choose between them. So I have a Profile model with > an ImageField for the userpic. When users upload a file it is > displayed around the site as usual. When

Re: getting database definition in line

2009-02-03 Thread Eric Abrahamsen
On 2月4日, 下午12时03分, Malcolm Tredinnick <malc...@pointy-stick.com> wrote: > On Tue, 2009-02-03 at 19:47 -0800, Eric Abrahamsen wrote: > > > On Feb 4, 11:25 am, Malcolm Tredinnick <malc...@pointy-stick.com> > > wrote: > > > On Tue, 2009-02-03 at 19:10 -

Re: getting database definition in line

2009-02-03 Thread Eric Abrahamsen
On Feb 4, 11:25 am, Malcolm Tredinnick <malc...@pointy-stick.com> wrote: > On Tue, 2009-02-03 at 19:10 -0800, Eric Abrahamsen wrote: > > Hi there, > > > I'm unable to do any testing -- my fixtures fail with a "Duplicate > > Entry" error when loading.

getting database definition in line

2009-02-03 Thread Eric Abrahamsen
Hi there, I'm unable to do any testing -- my fixtures fail with a "Duplicate Entry" error when loading. From what I've googled, this might have something to do with a mismatch between my model definitions and the sql table definition. This fails on a model that I've done a lot of manual sql

Re: Custom Template Tag - Passing variable for use in tag processing

2009-01-27 Thread Eric Abrahamsen
On Jan 28, 2009, at 1:52 AM, phoebebright wrote: > > I have duplicated as best I can the processing for handling variables > in custom template tags mentioned in an earlier post but it's not > working for me as I need the value of the variable before I parse it. > Is there another way of making

Re: how to avoid hardcoding of logfile path in logging.conf file

2009-01-27 Thread Eric Abrahamsen
riate function there. The syntax for the logging handler is a bit of a PITA, but that's just how Python logging works... Hope that helps, Eric > On Jan 27, 6:37 pm, Eric Abrahamsen <gir...@gmail.com> wrote: >> On Jan 27, 2009, at 9:28 PM, Thomas Guettler wrote: >> >> >

Re: how to avoid hardcoding of logfile path in logging.conf file

2009-01-27 Thread Eric Abrahamsen
On Jan 27, 2009, at 9:28 PM, Thomas Guettler wrote: > > Rama schrieb: >> please look at the below logging.conf file. >> ... >> can any one guide me on how to avoid hardcoding of log file path ? >> >> > Hi, > > I am not a logging expert, maybe there is a solution, but if you > do your setup

Re: Can't get django comments to pick up alternate form

2009-01-24 Thread Eric Abrahamsen
On Jan 25, 2009, at 1:54 PM, Theme Park Photo, LLC wrote: > > Also from reading the source, I don't see any mechanism by which it > would pick up form.html from any other than the three directories > enumerated there. Am I really supposed to edit and setup.py install > the django framework to

Re: Anyway to see full UrlConf list of available imported urls?

2009-01-22 Thread Eric Abrahamsen
Here's one way. There's likely a cleaner option somewhere else: from django.core.urlresolvers import get_resolver r = get_resolver('mysite.urls') for pattern in r._get_url_patterns(): print pattern That works, at any rate. Yours, Eric On Jan 23, 2009, at 3:55 AM, NoviceSortOf wrote: > > >

Re: I am doing the tutorial part 1 and i got this error

2009-01-19 Thread Eric Abrahamsen
On Jan 19, 2009, at 4:17 PM, jazz wrote: > > c:\projects\mysite>python manage.py sql polls > Traceback (most recent call last): > File "manage.py", line 11, in >execute_manager(settings) > File "C:\Python25\Lib\site-packages\django\core\management > \__init__.py", line 340, in

Re: Definitive Captcha?

2009-01-17 Thread Eric Abrahamsen
There's not really much needed to get captcha or recaptcha working with django, mostly just a class or two. When I was using recaptcha I found that this module: http://code.google.com/p/recaptcha-django/ did most of what I needed. If you're shopping, however, I'd recommend Akismet

Re: How do i combine a list and a form in the same page using django?

2009-01-16 Thread Eric Abrahamsen
On Jan 16, 2009, at 5:10 PM, Gath wrote: > > Am building a Q page, sort of stackoverflow.com kinda page! Am > having a bit of a problem trying to render the form. Am pasing 3 > objects to the template that renders the page i.e. Question object, > Answers related to the question and Answer form

Re: Adding a view inside a view?

2009-01-14 Thread Eric Abrahamsen
On Jan 15, 2009, at 2:42 AM, Bradley wrote: > > I'm new to Django and I'm trying to modify an existing django website > for a local newspaper. They would like to have a polls on the their > website. I just used the tutorial from the djangoproject website to > create the polls module. It

Re: setting cookies following comment post

2009-01-11 Thread Eric Abrahamsen
ngo.contrib.comments.urls')), ...and more... ) The views that display comment forms check for this cookie, and use the information to populate the form. I suppose that could be done as a context processor. Hope someone finds that useful, Eric On Jan 4, 12:03 pm, Eric Abrahamsen <gir...@gmail.com&g

small contenttypes mystery

2009-01-10 Thread Eric Abrahamsen
I've got a Topic model, which is a bit like a category. Then there are TopicItem objects, which have a foreign key to a Topic, and a generic foreign key to anything else in the website, so that I can attach anything to a particular Topic. In my admin site, a few models have a generic

Re: first newbie question

2009-01-09 Thread Eric Abrahamsen
On Jan 9, 2009, at 10:19 PM, _Sebastian_ wrote: > > Hi all, > > I've been following the tutorial > http://docs.djangoproject.com/en/dev/intro/tutorial01/#playing-with-the-api > and working on a own test-project as well. > > so I tried to adapt from > > class Poll(models.Model): >question =

Re: HttpResponse HTML links missing URL prefix when emailing

2009-01-08 Thread Eric Abrahamsen
On Jan 8, 2009, at 8:37 PM, Eki wrote: > > Hi guys, > > I'm implementing a view which sends a (nightly) status report email. > The code works mostly fine. I can both receive the email and see the > result rendered as I query the view. The HTML shown and emailed is > gotten from the same

Re: Process file after upload

2009-01-07 Thread Eric Abrahamsen
On Jan 7, 2009, at 9:32 PM, dmishe wrote: > > Hey. > > I have FielField in my model for user to upload ZIP-archives. I want > to unpack that zip, place some files in some dirs and delete it just > after user uploaded it in admin. > > How can i do this? Model's save won't work because it gets

Re: Redirect User on First Log In

2009-01-05 Thread Eric Abrahamsen
On Jan 6, 2009, at 6:41 AM, Aruna wrote: > > I'm trying to redirect a user on their first log in, to a special > welcome page. Subsequent logins will go to a regular page. Is there a > way to do that in the templates? Does Django have a way to check if > it's a users first login? User

Re: FileSystemStorage content vs PIL Image - **Initial solution**

2009-01-05 Thread Eric Abrahamsen
On Jan 5, 2009, at 7:47 PM, Donn wrote: > > On Monday, 05 January 2009 00:51:03 Donn wrote: >> I am stuck on the interface between a PIL Image and a >> FilesystemStorage 'content' object. >> >> I can: img = Image.open(content) >> But how do I pass 'img' back to Django for saving? > > I have

Re: FileSystemStorage content vs PIL Image

2009-01-04 Thread Eric Abrahamsen
On Jan 5, 2009, at 6:51 AM, Donn wrote: > > Hi, > I am stuck on the interface between a PIL Image and a > FilesystemStorage 'content' object. > > I can: img = Image.open(content) > But how do I pass 'img' back to Django for saving? > > My short class is pasted at end. The problem reported stems

Re: FileSystemStorage content vs PIL Image

2009-01-04 Thread Eric Abrahamsen
On Jan 5, 2009, at 6:51 AM, Donn wrote: > > Hi, > I am stuck on the interface between a PIL Image and a > FilesystemStorage 'content' object. > > I can: img = Image.open(content) > But how do I pass 'img' back to Django for saving? > > My short class is pasted at end. The problem reported stems

Re: AttributeError when trying to access the Admin application

2009-01-04 Thread Eric Abrahamsen
LASSES = ("django.contrib.sessions.middleware.SessionMiddleware", "django.contrib.auth.middleware.AuthenticationMiddleware", "django.middleware.common.CommonMiddleware", "django.middleware.doc.XViewMiddleware") Give that a shot. Eric > > &g

Re: AttributeError when trying to access the Admin application

2009-01-04 Thread Eric Abrahamsen
ception Value: 'WSGIRequest' object has no attribute 'user' > +++ > > I'm new to Django and I'm reading "The Definitive Guide to Django" > which seems to me too out dated... Yep, quite a lot has changed since that book was written... Yours, Eric > > > > On Jan 4, 1:34

Re: AttributeError when trying to access the Admin application

2009-01-04 Thread Eric Abrahamsen
back, and if that doesn't jog my memory we'll just see if someone else can jump in... E > On Jan 4, 1:06 pm, Eric Abrahamsen <gir...@gmail.com> wrote: >> On Jan 4, 2009, at 4:58 PM, HB wrote: >> >> >> >> >> >>> Hey, >>> I'm

Re: AttributeError when trying to access the Admin application

2009-01-04 Thread Eric Abrahamsen
On Jan 4, 2009, at 4:58 PM, HB wrote: > > Hey, > I'm trying to create Admin application for my Django project, here are > some snippets: > +++ > from django.contrib import admin > admin.autodiscover() > > urlpatterns = patterns('', > (r'^admin/(.*)', admin.site.root), > ) > > INSTALLED_APPS = (

setting cookies following comment post

2009-01-03 Thread Eric Abrahamsen
Hi there, I'm adding a "remember me" checkbox to comment forms, so that regular commenters can avoid having to enter their personal information, if they want. I was originally thinking of making this a function attached to the comment_was_posted signal, but it will have to be implemented

Re: Django form HTML is rendered as TEXT

2008-12-25 Thread Eric Abrahamsen
On Dec 26, 2008, at 10:56 AM, s4shre...@gmail.com wrote: > > Hi Guys, > I am new to Django . My Django form HTML is rendered as TEXT . It > does not display the HTML as such. Are you maybe getting autoescaped? http://docs.djangoproject.com/en/dev/topics/templates/#id2 Eric > > > Please

Re: The view didn't return an HttpResponse object.

2008-12-16 Thread Eric Abrahamsen
On Dec 17, 2008, at 3:23 PM, oops wrote: > > def OrderPlacedView(request): >form = OrderPlaceForm() >try: >print "try" >print request.POST >#brand = BrandName.objects.get(pk=request.POST['brand']) >except: >print"nothing" >return

Re: Too Many Connections

2008-12-09 Thread Eric Abrahamsen
On Dec 10, 2008, at 1:30 AM, DULMANDAKH Sukhbaatar wrote: > >> File >> "/usr/local/python2.5/lib/python2.5/site-packages/ >> MySQL_python-1.2.2-py2.5-linux-i686.egg/MySQLdb/__init__.py", >> line 74, in Connect >> >> File >> "/usr/local/python2.5/lib/python2.5/site-packages/ >>

Re: misreporting verify_exists

2008-12-06 Thread Eric Abrahamsen
On Dec 7, 2008, at 11:44 AM, Malcolm Tredinnick wrote: > > > On Sun, 2008-12-07 at 14:42 +1100, Malcolm Tredinnick wrote: > [...] > >> So have a look at the result of something like "curl -I http://... >> " (or >> equivalent tool if you don't have curl around). Basically, force a >> HEAD >>

misreporting verify_exists

2008-12-06 Thread Eric Abrahamsen
I've got a model with a URLField, with verify_exists set to True, which has suddenly started barfing "broken link" on a certain URL. I'm quite sure the URL exists, and can't figure out why it can't get past validation. This is the link:

Re: template tag

2008-12-05 Thread Eric Abrahamsen
On Dec 6, 2008, at 8:31 AM, Alfredo Alessandrini wrote: > > Hi, > > I've this variable in my template: {{ challenger.rating }} > > It'a a number... > > Can I calculate a sum like this: > > {{ challenger.rating }} + 200 ?? > > I must write a custom tag? There's already a filter for that:

Re: XML templates

2008-12-02 Thread Eric Abrahamsen
On Dec 2, 2008, at 5:50 PM, Vicky wrote: > > I did as you said. Still its giving the same error :( Do you have the correct permissions on the TEMPLATE_DIRS directories? Have you written the paths with forward slashes? That's all I can think of. E > > > > On Dec 2, 11:38 am, Malcolm

Re: XML templates

2008-12-02 Thread Eric Abrahamsen
On Dec 2, 2008, at 5:50 PM, Vicky wrote: > > I did as you said. Still its giving the same error :( Are you using forward slashes instead of backslashes? The docs indicate that's necessary... > > > > > > On Dec 2, 11:38 am, Malcolm Tredinnick <[EMAIL PROTECTED]> > wrote: >> On Mon,

Re: XML templates

2008-12-01 Thread Eric Abrahamsen
On Dec 1, 2008, at 7:51 PM, Vicky wrote: > > Can we use XML files as templates instead of HTML? Anything that comes as a plain text file can be produced by a template: HTML, XML, plain text, email, iCAL, source code... Yours, Eric > > >

Re: Modify uploaded image

2008-11-30 Thread Eric Abrahamsen
On Nov 30, 2008, at 10:36 PM, Alex Jonsson wrote: > > Hey guys, > > I have an application where I want my users to be able to upload a > picture. The model contains a name field and a ImageField. > > My question is how the easiest way would be to modify this image > before saving it? That is,

  1   2   3   >