Re: Using composition in Django

2011-04-17 Thread W Craig Trader
On 04/16/2011 04:35 PM, Guevara wrote: Hello! I have two class, Person and employee, i need make a composition for this (Prefer composition over inheritance): class Person(models.Model): name = models.CharField(max_length=50) date_inclusion = models.DateField() # others fields cl

Re: two similar ways to show data, but only one working

2011-04-21 Thread W Craig Trader
On 04/21/2011 05:08 PM, Michael wrote: I try to do the same with http://127.0.0.1:8000/host/hostname1 to print every package that is installed on hostname1 urls.py --- [...] (r'^host/(?P[a-zA-Z]+)$', 'packages.views.host'), [] For starters, the pattern you've registered won't ma

Re: Is there an HTML editor that's Django-aware

2011-05-20 Thread W Craig Trader
On 05/20/2011 05:54 AM, BobX wrote: Pretty obvious question, but is there any recommended HTML editor that won't munch the Django template codes? I was using Amaya to form my pages, but after a couple of what-the-heck moments, I discovered that it sporadically "eats" the template codes - ones in

Re: running projects on the back of a base URL and having issues with the homepage

2010-12-15 Thread W. Craig Trader
Here's how I solved this problem for my own applications. Note that I use VirtualEnv to ensure that each application gets exactly the Python environment I want it to have. If you don't use VirtualEnv, it will make the WSGI startup script simpler. Assume that my application is installed with the

Re: virtualenv and deployment

2010-12-15 Thread W. Craig Trader
Alex ... In order to do a simple copy you'll need to make sure that: 1. You're using the exact same version of Python on the host as you use to develop. 2. Python is installed in exactly the same locations (host and local). 3. Your environment is located in the same locations (host an

Re: virtualenv and deployment

2010-12-15 Thread W. Craig Trader
Alex ... You're not going to be able to trick your host into loading mod_wsgi from an .htaccess file -- Apache doesn't allow the load directives in .htaccess files. While mod_python is not supported, and it has a large number of open issues, there aren't any specific security holes you really nee

Re: running projects on the back of a base URL and having issues with the homepage

2010-12-15 Thread W. Craig Trader
Graham ... I appreciate the criticism -- I had to build for both mod_python and mod_wsgi and there was some bleed through. - Craig - On Wed, Dec 15, 2010 at 17:11, Graham Dumpleton wrote: > > > On Wednesday, December 15, 2010 11:10:06 PM UTC+11, Craig Trader wrote: > >> Here's how I solved this

Re: Confused about thread locals... again.

2010-12-15 Thread W. Craig Trader
I think that the correct solution for your problem would be, instead of hacking around with the template path on the fly like this, to instead write a template loader for your application, and apply the logic you need within the template loader itself. See: http://docs.djangoproject.com/en/dev/ref

Re: Getting 'specified module cannot be found' error when synching model to DB

2010-12-15 Thread W. Craig Trader
It sounds like you have a Windows and/or Python path problem. The DLL that's being loaded (kernel32.dll?) isn't on the Windows path (or in the Python lib directory) when Python is attempting to load it. Certainly nothing to do with Django. What version of Python are you using? - Craig - On Wed

Re: virtualenv and deployment

2010-12-16 Thread W. Craig Trader
he LoadModule directive in .htaccess so I don't know what he want > and I'm waiting for a reply yet... > > You are using your self handler in python code to load the webpage? Can I > force here to use the python2.6 interpreter instead the 2.3? > > Thanks for you help! &

Re: use table not in the model

2010-12-16 Thread W. Craig Trader
Tonton ... See for details on how to use so-called 'raw' SQL (ie: not managed with models) within Django. - Craig - On Thu, Dec 16, 2010 at 09:16, Tonton wrote: > Hello > i like to use some database table that are not in my models.py > in f

Re: registering app level signal handlers

2010-12-16 Thread W. Craig Trader
I usually register the signals for a given application at the bottom of that app's model.py file. - Craig - On Thu, Dec 16, 2010 at 19:04, dmitry b wrote: > On Dec 16, 3:28 pm, Graham Dumpleton > wrote: > > On Friday, December 17, 2010 10:00:55 AM UTC+11, dmitry b wrote: > > > > Are you talkin

Re: VirtualHost and external IP

2010-12-18 Thread W. Craig Trader
Andy ... Really hard to answer this without any knowledge of your network architecture. Presumably you have some sort of firewall/router/NAT between the Internet and your server. If you were working in a company with an IT department, you'd have asked them, not us, right? So, assuming a SOHO se

Re: What's your workflow?

2010-12-22 Thread W. Craig Trader
Dana ... How you build and deploy your project will be shaped by the environment where you're deploying. Thus my choices about "best practices" will be very different that yours. That said, here are my thoughts (worth exactly what they cost you): - You're definitely right about using South

Re: Massive insertion of records

2010-12-27 Thread W. Craig Trader
Derek ... Quoting from http://docs.djangoproject.com/en/1.2/topics/db/transactions/: > Django’s default behavior is to run with an open transaction which it > commits automatically when any built-in, data-altering model function is > called. For example, if you call model.save() or model.delete()

Re: Massive insertion of records

2010-12-27 Thread W. Craig Trader
Hey ... that's left as an exercise for the student, and wasn't relevant to the point in question (doing commits along the way). In point of fact, when doing mass inserts, serious attention needs to be paid to how frequently to commit, and what to do about failures and other exceptional behavior.

Re: Attempting to save instance with null ID?

2010-12-30 Thread W. Craig Trader
Jonathan ... The problem is in the difference in SQLite and Oracle. Unlike MySQL, PostgresQL, and SQLIte, Oracle doesn't have auto-generated primary keys. To make up for that, Django on Oracle uses a trigger for each Django-managed table that recognizes a NULL primary key on insert, and generate

Re: Django dev server issue

2011-01-02 Thread W. Craig Trader
The exception you're seeing is just a response to stopping the request in the browser. The real problem is that your view function is hanging. Could you post the source to the view (and the substantial parts of your template)? Very hard to offer suggestions without the right data. - Craig - On

Re: Django dev server issue

2011-01-02 Thread W. Craig Trader
You'll probably want to install the Django debug toolbar ( https://github.com/robhudson/django-debug-toolbar) at some point, though it doesn't help much with views that hang or throw exceptions. - Craig - On Sun, Jan 2, 2011 at 16:25, daniels wrote: > Hi, > I'm having a issue with Django's dev

Re: Django dev server issue

2011-01-03 Thread W. Craig Trader
I'm currently developing on Windows 7 (64-bit) with stock Python 2.6.6 (32-bit) and Django 1.2.3, and having no problems when running the Django development server from the command line. I'd recommend using the normal Python ( http://www.python.org/download/releases/2.6.6/) instead of ActivePython

Re: Help on adding CSS to django project

2011-02-04 Thread W. Craig Trader
The exact method of adding media resources to a Django application will depend on a number of factors (OS, Webserver, project layout) but it's fairly straight-forward. Here's the approach that I use: Assume that my Django project is named 'foo' and that any media (CSS, Javascript, etc) files I wa