from future url -- argh

2012-06-14 Thread JeffH
django 1.4 topapp urls.py ... url(r'^shows/', include('shows.urls')), template base.html ... {% url shows.views.customers %} shows urls.py .. url(r'^customers/$', 'shows.views.customers') The above works just fine -- everything is happy except for the deprecation w

Re: can't add via admin, get django template error

2010-12-09 Thread JeffH
think that the admin should accept such a (properly formed) date string. Or else the model shouldn't validate. On Dec 8, 2:20 pm, Wayne Smith wrote: > On Wed, Dec 8, 2010 at 10:49 AM, JeffH wrote: > > So I'm working along, everything's humming fine. Then I try to add a >

can't add via admin, get django template error

2010-12-08 Thread JeffH
So I'm working along, everything's humming fine. Then I try to add a record via the admin, and get the following: TemplateSyntaxError at /admin/expert/expertresponse/add/ Caught AttributeError while rendering: 'unicode' object has no attribute 'date' [snip] Template error In template c:\python2

Re: HttpResponseRedirect

2010-08-07 Thread JeffH
Another approach that I used recently: # urls.py (r'^ThankYou/(?P\d{4})/$', views.ThankYou), # message defs in views.py # messages for ThankYou page ty_messages = { '' : 'Invalid message specified.', '0001' : 'Pending dealer record has been re-saved, awaiting approval.', '0002'

Re: outer join in orm

2010-06-21 Thread JeffH
r original queryset). > > Scott Gould's answer is about as good as you'll get I reckon. > > On Jun 21, 3:37 pm, JeffH wrote: > > > That looks reasonable... but I wonder if the ORM can do it directly > > somehow. Anyone? > > > On Jun 21, 10:14 am, Scott

Re: outer join in orm

2010-06-21 Thread JeffH
_answers = [(q, [a for a in answers if a.question = q]) > for q in questions] > > ...which should give you a list of (question, ) > tuples. > > On Jun 21, 10:00 am, JeffH wrote: > > > To clarify: Each race has a set of questions. The candidate may have > > responded

Re: outer join in orm

2010-06-21 Thread JeffH
answers get displayed. On Jun 21, 8:41 am, Daniel Roseman wrote: > On Jun 21, 12:51 pm, JeffH wrote: > > > > > I have some models that (simplified) look like the following. > > > class Answer(models.Model): > >     id = models.CharField(max_length=3

outer join in orm

2010-06-21 Thread JeffH
I have some models that (simplified) look like the following. class Answer(models.Model): id = models.CharField(max_length=32, primary_key=True) text = models.TextField(blank=False) question = models.ForeignKey(Question) candidate = models.ForeignKey(Candidate) class Question(mode

Re: Hosting for Django sites

2010-04-05 Thread JeffH
Valcato.com offers shared and dedicated hosting, including good Django support. I've got two Django sites with them now. Home office is in UK. --Jeff On Apr 4, 8:33 pm, Nick Lacey wrote: > Matt wrote: > >  plus im uk based so  phone wouldn't really help. > > Speaking of being UK based .. for the

django admin instance needs to have a primary key value before a many-to-many relationship can be used

2010-03-11 Thread JeffH
Hello, I'm a relative newcomer to Django and love it. I'm having a problem with a m:m relationship in the admin. Stripped down, I have two models, Fact and FactSet class Fact(models.Model): Name = models.CharField(max_length=64, unique=False, blank=False, db_index=True) class FactSet(models.

Re: Hosting for django?

2009-12-24 Thread JeffH
Tried DreamHost, which is OK for shared static sites; fuggetaboutit vis a vis Django. I've been using http://www.valcatohosting.com/. They have some good getting started docs and excellent support. Good for low volume shared hosting. For a large upcoming project, I'm looking at either Linode or Sli

Re: newb URL mapping problem

2008-07-09 Thread JeffH
Thanks. I can live with it. The main thing is knowing I'm not crazy. ;-) On Jul 9, 8:00 am, Malcolm Tredinnick <[EMAIL PROTECTED]> wrote: > On Wed, 2008-07-09 at 04:51 -0700, JeffH wrote: > > I have a URL mapping problem, running 0.96.2 on Windows. > > > The proble

newb URL mapping problem

2008-07-09 Thread JeffH
I have a URL mapping problem, running 0.96.2 on Windows. The problem: I have to specify the site name in the urls.py or else I get 404s. For example: urlpatterns = patterns('', (r'^/$', home), (r'^/home/$', theview), (r'^SouthHavenReservations/home1/$', theview1), (r'^SouthHavenR

Re: Validating dynamically generated fields (guess i'll need a metaclass)

2007-09-14 Thread JeffH
I agree with Doug B's advice - I've used that "list of forms with different prefixes" technique and it works very well and the code should be easy for others to follow down the road. You actually don't need a prefix hidden field for each fieldset - one hidden field containing the number of fieldse

Re: Best Practices to Make your Apps Portable

2007-07-27 Thread JeffH
I use the following: my pythonpath includes /usr/local/lib/django/ within which I have: apps/ app1/(models,views,urls) app2/(models,views,urls), etc. vhosts/ vhost1/(settings,urls) vhost2/(settings,urls), etc. within the config for each apache virtual host

Re: SQL VIEWs as Django Models for aggregation --- delete() issues with django.db.models.query: delete_objects

2007-07-17 Thread JeffH
> > 3. That said, my delete_objects() hack was an attempt to solve the > > more general problem of using an overridden delete() without any > > special flags while allowing for the possibility of model subclassing > > in the future, because it seemed that respecting an overridden > > delete() was

Re: SQL VIEWs as Django Models for aggregation --- delete() issues with django.db.models.query: delete_objects

2007-07-16 Thread JeffH
ion (by omission) that overriding delete() is analogous is incorrect. 5. A big ongoing thanks to all of Django's contributors. You rock! Thanks for reading this. Cheers, Jeff On Jul 15, 1:24 am, "Russell Keith-Magee" <[EMAIL PROTECTED]> wrote: > On 7/13/07, JeffH <[EMA

Re: little problem

2007-07-13 Thread JeffH
more efficient that my way of do it, I was getting the > user from the database to see if the user exist. I like your solution, is > pretty clean and simple. Thanks a lot. > > On 7/13/07, Jacob Kaplan-Moss <[EMAIL PROTECTED]> wrote: > > > > > On 7/13/07,

Re: little problem

2007-07-13 Thread JeffH
this works for me: if getattr(model_instance, 'id', None) is None: model_instance.created_by = whatever On Jul 13, 1:28 pm, "Lic. José M. Rodriguez Bacallao" <[EMAIL PROTECTED]> wrote: > Hi, I got a little problem. I need to store in a model the first user who > created it (created_by) and the

SQL VIEWs as Django Models for aggregation --- delete() issues with django.db.models.query: delete_objects

2007-07-13 Thread JeffH
This post relates to two separate Django issues that intertwined for me: 1. Lack of aggregation support in Django's ORM (I am delighted to see http://groups.google.com/group/django-developers/browse_thread/thread/f433edf7b0ebdbcb/ ) 2. Django does not use delete() methods for related objects (as

Re: How to render newforms dynamically created fields?

2007-04-30 Thread JeffH
Two thoughts on this: First: you could define an appropriate label for the dynamic formfields as you create them in your FormList class (not shown here) such as the name of the thing that would be deleted, and then use the as_p shortcut to render the whole form rather than trying to loop: with a

Ticket-worthy? 0.96 newforms custom widget TypeError exception suppressed by render_to_response

2007-04-09 Thread JeffH
Is this worthy of a ticket? Observed behavior: Django (v0.96) render_to_response renders a template but renders nothing for {{ form.as_table }} tag when (unbeknownst to the poor programmer) a TypeError exception is raised during the rendering of a custom newforms widget. My preferred behavior: g