Validation system for models

2008-03-07 Thread Hugh Bien
For the website I'm writing, I've just been overriding the 'validate()' method on models but that's still experimental: http://www.djangoproject.com/documentation/models/validation/ Is there a built-in validation system for Django models? - Hugh --~--~-~--~~~---~--~-

Re: How to get Model from object?

2008-03-03 Thread Hugh Bien
In Python, you can always get a class from an object using the built-in 'type' method: type(mymodel_obj) On Mon, Mar 3, 2008 at 7:09 PM, Davide.D <[EMAIL PROTECTED]> wrote: > > class MyModel(models.Model): >... >... > > How to get MyModel from mymodel_obj? > > Thanks! > > > --~--~---

Re: Not using Django's built in auth, getting errors on 404s

2008-02-10 Thread Hugh Bien
n Feb 10, 2008 3:49 AM, Malcolm Tredinnick <[EMAIL PROTECTED]> wrote: > > > On Sun, 2008-02-10 at 03:05 -0800, Hugh Bien wrote: > > Hi, > > > > > > I'm not using Django's built in auth application. When I go to a URL > > that doesn't ex

Not using Django's built in auth, getting errors on 404s

2008-02-10 Thread Hugh Bien
et the 404.html page rendered as expected. But it seems kind of strange that I'd have to do this because I'm not using the auth application. It's probably something wrong with my settings.py, has anyone else had the same issue? Thanks, - Hugh Bien --~--~-~--~~~--

Multiple columns for db_indexes ?

2008-01-27 Thread Hugh Bien
Hi, I've been googling around for a while, but I haven't found a way to create indexes with multiple columns, ie. class Person(models.Model): last_name = models.CharField(maxlength=255) first_name = models.CharField(maxlength=255) And then create an index (last_name, first_name). Thanks

Re: Django Application Without Source?

2007-12-11 Thread Hugh Bien
Ttry using pyobfuscate. It works really well with python 2.3 (run it using python 2.3 and only use it on python 2.3 compatible code). - Hugh On 12/10/07, Kenneth Gonsalves <[EMAIL PROTECTED]> wrote: > > > try java, or C or even BF > > On 11-Dec-07, at 10:32 AM, [EMAIL PROTECTED] wrote: > > > > >

Re: Django Web Hosting Service

2007-11-21 Thread Hugh Bien
Another +1 for webfaction. The cheapest plan supports Django, 7.50/mo for two years in advance, but you can get a refund for your remaining time if you're not satisfied. Pretty sweet deal. On 11/21/07, Daniel Roseman <[EMAIL PROTECTED]> wrote: > > > On Nov 21, 1:57 pm, cwurld <[EMAIL PROTECTED]>

Commercial downloadable Django products

2007-11-11 Thread Hugh Bien
Hi all, Out of curiosity, has anyone made commercial Django products that are available for download/running on your own server? I was wondering what you used for source code protection or if you went the 'full source code available' route (like haveamint.com and warehouseapp.com ). Thanks! - Hug

Custom SQL to delete cache table

2007-11-05 Thread Hugh Bien
Hi all, I'm trying to clear the cache table. Here's the code I'm using with Python 2.5 and Django version 0.96: def clear_cache(): from django.db import connection cursor = connection.cursor() cursor.execute("DELETE FROM django_cache WHERE 1=1") This is for the a SQLite3 backend, but

Re: Having trouble with per-view caching

2007-11-04 Thread Hugh Bien
Thanks guys, that did the trick and caching works great now. On 11/4/07, Karen Tracey <[EMAIL PROTECTED]> wrote: > > On 11/4/07, Hugh Bien <[EMAIL PROTECTED]> wrote: > > > By what level do you mean what version of Django? I'm running Django > > 0.96.

Re: Having trouble with per-view caching

2007-11-04 Thread Hugh Bien
Hi Karen, By what level do you mean what version of Django? I'm running Django 0.96. - Hugh On 11/4/07, Karen Tracey <[EMAIL PROTECTED]> wrote: > > On 11/4/07, tonemcd <[EMAIL PROTECTED]> wrote: > > > check this out:- > > http://groups.google.com/group/django-users/msg/581a32c198e6ae07 > > > > No

Having trouble with per-view caching

2007-11-04 Thread Hugh Bien
Hi, I've emailed a few questions to this mailing list already and I've gotten great responses, so thanks everyone for helping out people who are new to Django. Okay, on to my question. I'm trying to get caching working with my weblog but I keep running into an AttributeError. All I am doing is i

Re: Python SSH Library for Deploy Script

2007-10-29 Thread Hugh Bien
Thanks! That's exactly what I was looking for. On 10/27/07, Michael Cuddy <[EMAIL PROTECTED]> wrote: > > > > I'm writing a deploy script, but right now it runs ssh commands directly > > from os.system: > > Paramiko. > > http://www.lag.net/paramiko/ > > -- > Mike Cuddy ([EMAIL PROTECTED]), Program

Python SSH Library for Deploy Script

2007-10-27 Thread Hugh Bien
Hi all! I'm writing a deploy script, but right now it runs ssh commands directly from os.system: import os os.system("ssh server.name.com 'cd /deploy/path && run commands'") I'm pretty new to Python and I'm trying to find a SSH library to run commands on a remote server. Does anyone have any exp

Re: authentication on generic views

2007-10-26 Thread Hugh Bien
I haven't really used generic views that often, but I know you could always extend them by creating your own views. Inside your views.py: from django.views.generic.list_detail import object_list @login_required def my_list(*args, **kwargs): return object_list(*args, **kwargs) - Hugh On 10/2

Re: Newbie error: sqlite3.OperationalError: unable to open database file

2007-10-21 Thread Hugh Bien
For your DATABASE_NAME, try using an absolute path without the tilde (~) shortcut, that might solve it: DATABASE_NAME = '/home/ssk/Projects/mysites/mysite/mysite.db' On 10/21/07, SSK <[EMAIL PROTECTED]> wrote: > > > I'm trying to get started with Django, but I've hit a hurdle with > database. > >

Re: template loading and generic views

2007-10-20 Thread Hugh Bien
foo/templates/foo/bar.html foo/templates/foo/bar_list.html This is the way I've been doing it (app/templates/app/model.html). It works well when you want to re-use your apps to make sure template names don't conflict with other apps. On 10/20/07, Leo Shklovskii <[EMAIL PROTECTED]> wrote: > > > D

Re: new : advise on installing Django, issues

2007-10-18 Thread Hugh Bien
sult, the suggested commands in the installation guide are not > working. > > 232:~ $ sudo python setup.py install > Password: > /Library/Frameworks/Python.framework/Versions/2.5/Resources/Python.app/ > Contents/MacOS/Python: can't open file 'setup.py': [Errno 2]

Re: new : advise on installing Django, issues

2007-10-18 Thread Hugh Bien
I think you're trying to run the 'tar' program inside the Python shell. Instead, just run it in your command line without running Python. You could also just find the Django-0.96.tar.gz file in Finder and double click on it. Django comes with its own server for development, so you don't need Ap

Re: Customizing Django's Auth System

2007-10-18 Thread Hugh Bien
I was thinking about doing that, but I didn't want to roll my own authentication system if would be easier to just customize what's already been done. On 10/18/07, Amirouche <[EMAIL PROTECTED]> wrote: > > > if you only need User, write you own User model, no ? > >

Customizing Django's Auth System

2007-10-18 Thread Hugh Bien
Hi all, I was wondering if it was possible to customize Django's Auth system to not include permissions, groups, or messages. For the app I'm working on, just have a User model would be great. - Hugh --~--~-~--~~~---~--~~ You received this message because you are

django_root or application_root ?

2007-10-10 Thread Hugh Bien
Hi, I'm a Django newbie (just finished the tutorial on djangobook.com). I'm about to try building a blog with Django to learn some more and I was wondering if there's some sort of DJANGO_ROOT that specifies the path to the root of your project. The djangobook tipped us to use Python's __file__ fo