Re: Problem with URL naming, generic templates and custom filtering wrappers

2009-10-10 Thread Scott SA
Hi Karen, On Oct 10, 5:58 pm, Karen Tracey wrote: > On Sat, Oct 10, 2009 at 6:34 PM, Scott SA wrote: > > I am trying to use a series of generic views with custom filtering via > > callbacks as per: > I cannot figure out how this one differs from the

Re: efficiently deleting content based on how old it is

2009-10-10 Thread buttman
I'm the author. Are you sure the comments are broken? I just made one and it seemed to work. On Oct 10, 11:55 pm, Kenneth Gonsalves wrote: > On Sunday 11 Oct 2009 9:07:38 am buttman wrote: > > > you could also do it this way: > >

Re: efficiently deleting content based on how old it is

2009-10-10 Thread Kenneth Gonsalves
On Sunday 11 Oct 2009 9:07:38 am buttman wrote: > you could also do it this way: > > http://pythonblog300246943.blogspot.com/2009/09/cron-jobs-with-django-made- >easy.html interesting - but the author's commenting module is b0rked, so was unable to add a comment (I hope he sees this and sets it

Re: efficiently deleting content based on how old it is

2009-10-10 Thread buttman
you could also do it this way: http://pythonblog300246943.blogspot.com/2009/09/cron-jobs-with-django-made-easy.html On Oct 9, 5:56 am, Chris Withers wrote: > Streamweaver wrote: > > You could set this up as a custom manage.py command and run a cron on > > that.  Gives

Re: Problems with custom Auth Backends: 'NoneType' object has no attribute 'DoesNotExist'

2009-10-10 Thread Shawn Milochik
The way to do what you're trying to do is to take advantage of the following: http://docs.djangoproject.com/en/dev/topics/auth/#storing-additional-information-about-users In brief, you'll create another model, which will then be specified in your settings.py by AUTH_PROFILE_MODULE. From

Re: efficiently deleting content based on how old it is

2009-10-10 Thread Shawn Milochik
Chris, I know this doesn't answer the hard part of your question, but here's a simple way I delete old stuff from a database via an external script that's run by cron: Item.objects.filter(date_updated__lte = datetime.now() - timedelta (days = 30)).delete() If you use timedelta, you can

Re: iphone to website

2009-10-10 Thread Shawn Milochik
On Oct 8, 2009, at 9:33 AM, grant neale wrote: > > Well 1 problem I was thinking about was uploading photos. > Any suggestion. > > Grant While it's not Django-specific, it's easy to write a Python script that monitors an e-mail address and downloads and stores the attachments. You could

Distance across a LineString in GeoDjango

2009-10-10 Thread HARRY POTTRER
I have a model which represents a route. I can use the `make_line()` geoqueryset method to create a LineString like so: >>> r = Route.objects.get(pk=33) >>> # a route from Seattle to New York to Miami, a total distance >>> # of about 3043.8 nautical miles >>> r >>> # a collection of the

Re: Newbie: Trouble getting "import django" to run on Mac OSX 10.5.8

2009-10-10 Thread dbakerweb
I think I figured out my error. I was told to copy the new sub- directory named "django" to site-packages. I copied the whole directory (django-1.1) there instead. I made the fix. Now when I "import django" I just get the prompt back - no error. I assume it is working. Thanks for the time you

Re: Redirect home page

2009-10-10 Thread Kurt Neufeld
You could use middleware to do this as I learned last week, but why not just make a "view" which is only a function. urls.py: ... (r'^$', 'views.DomainRootRedirect' ) ... views.py: def DomainRootRedirect( request, *args, **kwargs ): return

Re: Problem with URL naming, generic templates and custom filtering wrappers

2009-10-10 Thread Karen Tracey
On Sat, Oct 10, 2009 at 6:34 PM, Scott SA wrote: > > Hi, > > I am trying to use a series of generic views with custom filtering via > callbacks as per: > > > http://docs.djangoproject.com/en/dev/topics/generic-views/#extending-generic-views > > Unfortunately, when I try to

Re: Newbie: how to get data validation without user interaction?

2009-10-10 Thread Jim DeLaHunt
Yes, Malcolm's “Django Tip: Poor Man's Model Validation” is very helpful. That should give me enough for this application (which is very contained and well-behaved). It's good to know that the term is "model-aware validation", and that it wasn't somewhere in Django 1.0 that I overlooked. It's

best way to build a form for m2m-related models (via intermediary table)?

2009-10-10 Thread DaleB
hi, i am looking for an advice concerning django's forms and formsets. i am creating a ticket system where the assignees and tickets are associated via an intermediary table/model. that's what the models basically looks like: class Ticket(models.Model): title =

Re: Newbie: having trouble with save method

2009-10-10 Thread Karen Tracey
On Sat, Oct 10, 2009 at 6:04 PM, Senthil wrote: > > Hey Guys, > I am not able to understand this behavior happening in django > > My models.py is as follows > > from django.db import models > from django.contrib.auth.models import User > > > class ht_wt(models.Model):

Re: Foreign language in View Model.

2009-10-10 Thread Rizwan
I am trying to extend flatpage view...I have added custom code here..you can see navigation showing question mark here http://beta.rmansuri.net/homepage/ from django.contrib.flatpages.models import FlatPage from django.template import loader, RequestContext from django.shortcuts import

Problem with URL naming, generic templates and custom filtering wrappers

2009-10-10 Thread Scott SA
Hi, I am trying to use a series of generic views with custom filtering via callbacks as per: http://docs.djangoproject.com/en/dev/topics/generic-views/#extending-generic-views Unfortunately, when I try to name the URL in urls.py, I get various errors depending upon how I try to write the

Re: Newbie: how to get data validation without user interaction?

2009-10-10 Thread Karen Tracey
On Sat, Oct 10, 2009 at 6:17 PM, Jim DeLaHunt wrote: > > [snip] > 3. Understand if the Django Modelform is the way I ought to be > handling this. Forms are the only Django entity for which I can find > documentation about doing validation in accordance with the Model. >

Redirect home page

2009-10-10 Thread Caisys
Hi, I would like visitors to my site homepage www.example.com to be redirected to www.example.com/en/ in order to allow for translations in the future. What is the most efficient way? 1- Use apache mod-rewrite? 2- I know i could use the HttpResponseRedirect function in django but i felt it

Newbie: how to get data validation without user interaction?

2009-10-10 Thread Jim DeLaHunt
Hi, folks: I appreciate the people who are willing to help out newbies here. In my journey up Django Mountain, I'm now at the stage where I want to validate data. My app is not interactive and has no web component; I'm just using Django as a database access layer. My app reads some data out of

Re: 'NoneType' object has no attribute 'widget'

2009-10-10 Thread redawn
Hey, can anybody figure out what's going on around here. I stumbled on this post since I have a similar issue, 'GeoPt' object has no attribute 'widget'. I followed Karen's response and it seems that I have a similar issue since I don't explicitly declare 'location' and 'location_geocells' in my

Newbie: having trouble with save method

2009-10-10 Thread Senthil
Hey Guys, I am not able to understand this behavior happening in django My models.py is as follows from django.db import models from django.contrib.auth.models import User class ht_wt(models.Model): user = models.ForeignKey(User) EntryDate = models.DateField(auto_now = True)

Re: Running just core regression tests

2009-10-10 Thread Karen Tracey
On Sat, Oct 10, 2009 at 11:41 AM, Tim Chase wrote: > > Currently, I use > > t...@rubbish:~/django/trunk/tests$ python runtests.py > --settings=settings > > to execute the core set of tests. However, it takes quite a > while (on the order of hours) on my old box.

Re: Newbie: Trouble getting "import django" to run on Mac OSX 10.5.8

2009-10-10 Thread dbakerweb
I followed the install instructions in the book entitled: "Python Web Development with Django". I copied the expanded Directory "Django-1.1" to /Library/Python/2.5/site-packages. I don't know how to answer the question about the pythonpath because that is the "howto" info that is missing. One

Re: Newbie: Trouble getting "import django" to run on Mac OSX 10.5.8

2009-10-10 Thread Daniel Roseman
On Oct 10, 4:01 pm, dbakerweb wrote: > I have gotten to the point where I want to test my install of Django. > I run "import django" and get the "No module named django" error. I > suspect it is a path issue but I've not been able to understand any > googled results for

Re: Xampp and django

2009-10-10 Thread Daniel Roseman
On Oct 10, 3:43 pm, djbahati wrote: > Hi All, > Am new to django, > am developing application but i face a problem in displaying template. > The browser does not display any template it just display plain text. > am using django 1.1 and xampp 1.7.1. Any idea?

Re: How to create a 3rd-party database driver

2009-10-10 Thread Daniel Rhoden
Thanks guys. This is much better information than what I had. On Oct 9, 5:29 pm, Daniel Rhoden wrote: > Can you direct me to the documentation for creating my own 3rd-party > database driver? > > I'm wanting to create a sibling to the concept of a SQLite, MySQL, ... >

Re: Foreign language in View Model.

2009-10-10 Thread Joshua Russo
On Sat, Oct 10, 2009 at 9:15 AM, Rizwan wrote: > > Hello Djangoer, > > I am trying to create website with foreign language in it. I have > created model for content type and added one page in it. It saving > fine in database. When I have tried to write view model for

Re: Running just core regression tests

2009-10-10 Thread Russell Keith-Magee
On Sat, Oct 10, 2009 at 11:41 PM, Tim Chase wrote: > > Currently, I use > > t...@rubbish:~/django/trunk/tests$ python runtests.py > --settings=settings > > to execute the core set of tests.  However, it takes quite a > while (on the order of hours) on my old box.  

Running just core regression tests

2009-10-10 Thread Tim Chase
Currently, I use t...@rubbish:~/django/trunk/tests$ python runtests.py --settings=settings to execute the core set of tests. However, it takes quite a while (on the order of hours) on my old box. Is there a way to just run tests on the regressions/ subdirectory or even just a particular

Re: how to design mobile version of my site based on django?

2009-10-10 Thread Gerard
There's basically two ways. Conditionally have Django serve different templates, or even templates with conditions in them. The other is to make your site viewable in a phone as well as on a computer screen. Long term planning .. The 2nd is the better choice but that depends on your content.

Newbie: Trouble getting "import django" to run on Mac OSX 10.5.8

2009-10-10 Thread dbakerweb
I have gotten to the point where I want to test my install of Django. I run "import django" and get the "No module named django" error. I suspect it is a path issue but I've not been able to understand any googled results for fixing path issues. I am a newbie and not a Unix sysadmin. Please

Xampp and django

2009-10-10 Thread djbahati
Hi All, Am new to django, am developing application but i face a problem in displaying template. The browser does not display any template it just display plain text. am using django 1.1 and xampp 1.7.1. Any idea? --~--~-~--~~~---~--~~ You received this message

Re: how to design mobile version of my site based on django?

2009-10-10 Thread hao he
thank you. you means the greatest difference between PC and phone is the size of their screen. ok. and what I need to do is to ensure that the DIV+CSS is resizable. but .whether it is easy for DIV+CSS designed for PC to adapt the mobile screen? thank you . On Oct 10, 3:54 pm, Jani Tiainen

Re: newbie , need some help

2009-10-10 Thread Chris Withers
danin wrote: > I am just learning django from last 2 weeks. while learning i get > confused in validation. Can anyone plese provide me reference to some > material so that i can read and underatand it from ther. http://lmgtfy.com/?q=django+validation How about getting and reading the Django

Re: can I do doctest in view function? if I can, how to use fixture data in doctest?

2009-10-10 Thread hao he
the following 2 solution enable my view function doctest-able: --solution 1-it is not convenient to go to the error point in source.py -- add the following code to "models.py" of your "views.py" from common import

required fields during object instantiation

2009-10-10 Thread Chris Withers
Hi All, Assuming this model: class Month(models.Model): month = models.DateField( db_index=True, verbose_name='Month' ) def __unicode__(self): return unicode(self.month.strftime('%B %Y')) Now, I could have sworn this used to throw an error if I

newbie , need some help

2009-10-10 Thread danin
Hi all, I am just learning django from last 2 weeks. while learning i get confused in validation. Can anyone plese provide me reference to some material so that i can read and underatand it from ther. Thanks and regard --~--~-~--~~~---~--~~ You received this

Problem with cookies and template

2009-10-10 Thread Denis Bahati
Hi all, Am new to python and django but am facing aproblem with templates and login the admin page. 1) I cannot login to admin page page because django keeps giving me a message Look for your browser cofiguration to allow cookies but am sure my browser allows all cookies. 2) Am using xampp 1.7.1

Internationalized URLs

2009-10-10 Thread Anderson Santos
Hello, I'm trying to find the best approach to have multiple languages urls on reusable apps but I can't find a good way to do it and I couldn't find any useful information around. I am not sure if the best is just to do something like this: url(r'^%s/$' %

Foreign language in View Model.

2009-10-10 Thread Rizwan
Hello Djangoer, I am trying to create website with foreign language in it. I have created model for content type and added one page in it. It saving fine in database. When I have tried to write view model for this page. Its showing me "?" rather then foreign character. I am new born baby in

Re: Show first available Image in a loop

2009-10-10 Thread Mike Ramirez
On Saturday 10 October 2009 00:55:02 The Danny Bos wrote: > Good point. > Here's the models I'm talking about as they're slightly different than > your aforementioned solution. > > class Collection(models.Model): > title = models.CharField(max_length=50, unique=True, help_text="eg: >

Re: Model Class Inheritance question

2009-10-10 Thread Jani Tiainen
whiskeyjuvenile kirjoitti: > I'm making some sort of galactic map with the following classes > defined in models.py: > > class Star(models.Model): > name = models.CharField(max_length=200) > xcoord = models.FloatField() > ycoord = models.FloatField() > zcoord =

Re: Show first available Image in a loop

2009-10-10 Thread The Danny Bos
Good point. Here's the models I'm talking about as they're slightly different than your aforementioned solution. class Collection(models.Model): title = models.CharField(max_length=50, unique=True, help_text="eg: Pokemon, Kiss, Baseball ...") slug =

Re: how to design mobile version of my site based on django?

2009-10-10 Thread Jani Tiainen
hao he kirjoitti: > I'm developing my site with django, > > mainly, my site works as normal, visited by PC. > > but ,the site will also be visited by mobile device(e.g.iphone) > > who tell me the solution? > > or recommend me some relevant articles? This has almost nothing to do with Django.

Re: Simple Form and Model question

2009-10-10 Thread LuisC
Ja!! That is it... Changed the view function name and it works... Very nice... thank you to everybody. Regards On Oct 10, 2:27 am, Karen Tracey wrote: > On Sat, Oct 10, 2009 at 2:04 AM, LuisC wrote: > > > Hi!!! > > I am having troubles saving my first

Automatic user association, and confirmation page

2009-10-10 Thread Andrew Pendleton
I'm trying to figure out the best way to add an email address form field to the edit page for a model in the Django admin, and, upon save, automatically set a hidden foreign key to associate said model instance to the Django user with this email address, or, alternatively, create a new user with

Re: Simple Form and Model question

2009-10-10 Thread LuisC
Sorry about my ignorance but how would I give keyword arguments in the view? I just tried: BDbuff = Clientes(123,ClienteCodigo=form.cleaned_data ['ClienteCodigo'], ClienteNombre=form.cleaned_data ['ClienteNombre'],

Re: Simple Form and Model question

2009-10-10 Thread Karen Tracey
On Sat, Oct 10, 2009 at 2:04 AM, LuisC wrote: > > Hi!!! > I am having troubles saving my first model using a form: > > My Model: > Class Clientes(models.Model): >'Clase para Clientes' >ClienteCodigo = models.IntegerField('Codigo Cliente') >ClienteNombre =

Re: Simple Form and Model question

2009-10-10 Thread Kenneth Gonsalves
On Saturday 10 Oct 2009 11:34:11 am LuisC wrote: > So, what is the argument Clientes() is specting??? Why in shell the > field list with values are the correct arguments?? you are using keyword arguments in the shell and positional arguments in the view - maybe that is the problem? -- regards

Simple Form and Model question

2009-10-10 Thread LuisC
Hi!!! I am having troubles saving my first model using a form: My Model: Class Clientes(models.Model): 'Clase para Clientes' ClienteCodigo = models.IntegerField('Codigo Cliente') ClienteNombre = models.CharField('Nombre Cliente',max_length=40) ClienteFechaCreacion =