Re: No POST data

2007-05-03 Thread tomass

Turns out it was the "disabled" directive in the form. Weird, as I'm
pretty sure it works on other forms in other applications, but when I
remove it, it works great.

On May 3, 11:36 am, tomass <[EMAIL PROTECTED]> wrote:
> I realise this is likely something trivial I am missing, and I'm aware
> ofhttp://code.djangoproject.com/wiki/NewbieMistakes...
>
> However, I have a form that's set up like this:
>
> From:  disabled id="date_from" name="date_from" value="04/25/2007" size="10"
> maxlength="12" readonly="readonly" />Calendar.setup({ inputField : "date_from", button :
> "date_from_cal" }); To:  name="date_to" value="04/28/2007" size="10" maxlength="12"
> readonly="readonly" /> id="date_to_cal" style="cursor: pointer; vertical-align: top !
> important;" />Calendar.setup({ inputField : "date_to", button :
> "date_to_cal" });  (Oldest Log: Wed, 25 Apr 2007 09:12:26 +2000, Newest Log Fri,
> 27 Apr 2007 10:31:56 +2000)
>
> my urls.py looks like this:
>
> urlpatterns += patterns('monitor.zopelog.views',
> (r'^landscape/logs/$', 'index'),
> (r'^landscape/logs/(?P\d{8})/(?P\d{8})/$',
> 'index'),
> (r'^landscape/logs/daterange/$', 'parsedate'),
> )
>
> and here's my parsedate function:
>
> def parsedate(request):
>
> date_from = request.POST['date_from']
> date_from = date_from.split('/')
> date_to = "%s%s%s" % (date_from[2], date_from[0],
> date_from[1])
>
> date_to = request.POST['date_to']
> date_to = date_to.split('/')
> date_to = "%s%s%s" % (date_to[2], date_to[0], date_to[1])
>
> return HttpResponseRedirect('/landscape/logs/%s/%s/' %
> (date_from, date_to))
>
> However, when I try to submit data from this form I get:
>
> "Key 'date_from' not found in "
>
> Basically telling me there's no post data.
>
> Can anyone let me know what I'm missing. I have the trailing slash,
> and I've also tried removing the URL altogether and posting to "" and
> then picking up on it there, but no dice...
>
> Thanks for any help.
>
> Tom


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



No POST data

2007-05-03 Thread tomass

I realise this is likely something trivial I am missing, and I'm aware
of http://code.djangoproject.com/wiki/NewbieMistakes...

However, I have a form that's set up like this:

From: Calendar.setup({ inputField : "date_from", button :
"date_from_cal" }); To: Calendar.setup({ inputField : "date_to", button :
"date_to_cal" });  (Oldest Log: Wed, 25 Apr 2007 09:12:26 +2000, Newest Log Fri,
27 Apr 2007 10:31:56 +2000)

my urls.py looks like this:

urlpatterns += patterns('monitor.zopelog.views',
(r'^landscape/logs/$', 'index'),
(r'^landscape/logs/(?P\d{8})/(?P\d{8})/$',
'index'),
(r'^landscape/logs/daterange/$', 'parsedate'),
)

and here's my parsedate function:

def parsedate(request):

date_from = request.POST['date_from']
date_from = date_from.split('/')
date_to = "%s%s%s" % (date_from[2], date_from[0],
date_from[1])

date_to = request.POST['date_to']
date_to = date_to.split('/')
date_to = "%s%s%s" % (date_to[2], date_to[0], date_to[1])

return HttpResponseRedirect('/landscape/logs/%s/%s/' %
(date_from, date_to))

However, when I try to submit data from this form I get:

"Key 'date_from' not found in "

Basically telling me there's no post data.

Can anyone let me know what I'm missing. I have the trailing slash,
and I've also tried removing the URL altogether and posting to "" and
then picking up on it there, but no dice...

Thanks for any help.

Tom


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Login redirect

2006-11-12 Thread tomass

Sorry, too quick off the mark there. Seems exactly what I need can be
found here (basically just set up my own login/logout mechanism):

http://www.djangoproject.com/documentation/authentication/#authentication-in-web-requests

Thanks, Tom


--~--~-~--~~~---~--~~
 You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Login redirect

2006-11-12 Thread tomass

Hi Folks,

I'd like to be able to log users in based on accounts in Django and
then redirect them to a specific page after they've logged in. I'd also
like to be able to do a similar thing for logouts. Can anyone help me
out with this... Couldn't quite make sense of it from the
documentation, because it seems to rely on a hard-coded login URL of
/accounts/login. Do I have to set this up, or is there some other way
around it?

I've looked at the example in the sessions section of the documentation
and have set up a basic example that seems to work, but it seems a
little clunky.

Thanks, Tom


--~--~-~--~~~---~--~~
 You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Django SOAP server

2006-11-02 Thread tomass

Hi Jure,

Thanks for the response. I've made the changes you suggest, but just
have a few questions:

- The urls.py file: the soapview.soap - does this refer to a file
called "soapview.py" and then the "soap" portion refers to whatever the
name you assign the SimpleSOAPView() function to?

- How do I define a namespace for this? I'm using a soapclient as below
to test:

from SOAPpy import SOAPProxy
url = 'http://www.myserver.com/soap'
namespace = 'urn:soap'
server = SOAPProxy(url, namespace)
print server.f2()

And I get this error:

SOAPpy.Types.faultType: >

Thanks, Tom


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users
-~--~~~~--~~--~--~---



Django SOAP server

2006-11-01 Thread tomass

Hi Folks,

I'm interested in serving SOAP requests through Django. I've taken a
look at the pages below, but I'm not sure what the current state of
development is, as I couldn't get the example in 552 working.

http://code.djangoproject.com/ticket/552
http://code.djangoproject.com/ticket/115

I had to change some code in the soap.py as it was pre-magic-removal,
but it's still not working for me. The changes I made were to change
"from django.utils.httpwrappers import HttpResponseServerError,
HttpResponse" to "from django.http import HttpResponseServerError,
HttpResponse". I then added this to my urls.py:

urlpatterns += patterns('greenleaftech.jobmonitor.soapviews',
(r'^jobmonitor/rpc/$', 'f2'),
)

And in the soapviews.py I put:

from django.contrib.soap import SimpleSOAPView
soap = SimpleSOAPView()
def f2(request):
return 'f2'
soap.registerFunction(f2)

The error message I get is:

Mod_python error: "PythonHandler django.core.handlers.modpython"

Traceback (most recent call last):

  File "/usr/lib/python2.3/site-packages/mod_python/apache.py", line
299, in HandlerDispatch
result = object(req)

  File
"/usr/lib/python2.3/site-packages/django/core/handlers/modpython.py",
line 157, in handler
return ModPythonHandler()(req)

  File
"/usr/lib/python2.3/site-packages/django/core/handlers/modpython.py",
line 133, in __call__
response = middleware_method(request, response)

  File
"/usr/lib/python2.3/site-packages/django/contrib/sessions/middleware.py",
line 74, in process_response
patch_vary_headers(response, ('Cookie',))

  File "/usr/lib/python2.3/site-packages/django/utils/cache.py", line
104, in patch_vary_headers
if response.has_header('Vary'):

AttributeError: 'str' object has no attribute 'has_header'

Any help appreciated.

Thanks, Tom


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users
-~--~~~~--~~--~--~---



Re: Process forking issues

2006-08-21 Thread tomass

Well, limited success. I was able to get the code working through
closing the django db connection just after I'd forked my processes,
but it seems that what I thought I was doing wasn't really what I
thought I was doing.

Essentially I wanted to be able to run multiple tasks simultaneously. I
thought forking x numbers of processes would do this for me, but it
seems not. It looks to me like what happens in this case is that if you
try to fork 10 processes simultaneously it actually waits for the first
forked process to finish before starting the second one.

I think what I need to look into is multi-threading instead, but that
could be kind of complicated... More investigation needed.

Thanks, Tom


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users
-~--~~~~--~~--~--~---



Re: Process forking issues

2006-08-18 Thread tomass

Thanks, that's very helpful, and sounds very likely to be the problem.
I'll give it a try and see what I can come up with...

May take a little while but I'll post back once I have a resolution one
way or the others.

Cheers, Tom


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users
-~--~~~~--~~--~--~---



Process forking issues

2006-08-17 Thread tomass

Hi Folks,

I know this topic has been brought up a few times, but I have a
slightly different issue here (I think).

I have a backend process that runs a number of commands. It connects to
the database (via the ORM) to check it's queue and then executes jobs.
All fine and dandy.

My problem is that I have now got to the stage where I need to run more
than one of these jobs at a time as there are so many scheduled and if
they run one after another it takes too long.

I approached this by using this recipe to spawn a new process and then
run the backend processing function:

http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/66012

Problem is, I'm getting database connection errors and I can't quite
see why. I pass an object to my backend processing function and have
verified that I can access the properties of that object in the
function. However, I get the following errors:

Traceback (most recent call last):
  File "/automator/utils/backend.py", line 503, in ?
run_backend(LOGLEVEL)
  File "/automator/utils/backend.py", line 471, in run_backend
asyncRemoteCommand(c, l)
  File "/automator/utils/backend.py", line 429, in asyncRemoteCommand
RemoteCommand(c, l)
  File "/automator/utils/backend.py", line 193, in RemoteCommand
c.save()
  File "/home/mthaddon/django/magic-removal/django/db/models/base.py",
line 150, in save
cursor = connection.cursor()
  File
"/home/mthaddon/django/magic-removal/django/db/backends/postgresql/base.py",
line 42, in cursor
cursor.execute("SET TIME ZONE %s", [settings.TIME_ZONE])
psycopg.OperationalError: server closed the connection unexpectedly
This probably means the server terminated abnormally
before or while processing the request.

When I look at the postgresql logs I see:

LOG:  could not receive data from client: Connection reset by peer
LOG:  unexpected EOF on client connection

Seems like Python is blaming PostgreSQL and vice versa!

Any help appreciated.

Thanks, Tom


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users
-~--~~~~--~~--~--~---



Re: Rich text editor with code snippets

2006-07-28 Thread tomass

Thanks. Added in the extra Tiny MCE options (like the full screen one),
and it works pretty well just using the  tags.


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users
-~--~~~~--~~--~--~---



Rich text editor with code snippets

2006-07-25 Thread tomass

Hi Folks,

I'm wondering which rich text editors people are using in their apps,
and if any of them (that have been successfully integrated into the
admin app) have the capability to display code snippets.

Basically, what I'm looking for is a code block to render in fixed
width font and with all spaces/line breaks/tabs preserved. You know
what I mean.

I'm using Tiny MCE but haven't found a way to do this. Feel free to
knock me over the head if this is simply a case of using some 
tags and then putting the appropriate style sheets. I'm not enough of a
CSS wizard to know if that's the way I should be approaching this.

Thanks, Tom


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users
-~--~~~~--~~--~--~---



Re: Time field issues

2006-06-28 Thread tomass

Turns out it's because I had "default='09:00' in my model. I guess it
needs a time entry, not a string entry.


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users
-~--~~~~--~~--~--~---



Time field issues

2006-06-28 Thread tomass

Hi Folks,

I've just tried to add a time field to one of my models, and then I
ran:

ALTER TABLE blah ADD COLUMN blah_blah TIME;
UPDATE blah SET blah_blah='09:00:00'

I restarted apache, and I can see my current entries are showing 9am
correctly in the new "blah_blah" field, but when I try to add a new
entry into the "blah" table I get the following error:

AttributeError at /admin/runsheets/item/add/
'str' object has no attribute 'strftime'
Request Method: GET
Request URL:http://example.com/admin/runsheets/item/add/
Exception Type: AttributeError
Exception Value:'str' object has no attribute 'strftime'
Exception Location:

/usr/lib/python2.4/site-packages/Django-0.91-py2.4.egg/django/db/models/fields/__init__.py
in flatten_data, line 750

Any ideas what's happening here?

Thanks, Tom


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users
-~--~~~~--~~--~--~---



Re: User editing/adding broken in Admin interface

2006-06-12 Thread tomass

I changed the model name from Email to ProvEmail and that fixed it.
Seems like this may be a bug related to the one you were mentioning.

Thanks, Tom


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users
-~--~~~~--~~--~--~---



Re: Using DB module(s) in another app (twisted)

2006-06-12 Thread tomass

Don't see why you can't do just that. Is it not working for you, or are
you just wondering if it's possible? I use the db_api outside of Django
web apps with no problems...


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users
-~--~~~~--~~--~--~---



Re: User editing/adding broken in Admin interface

2006-06-12 Thread tomass

I've changed it to email_owner, and I still get the same message...
Incidentally, I don't have a model named owner, but changed it in case
it was a reserverd word...


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users
-~--~~~~--~~--~--~---



Re: User editing/adding broken in Admin interface

2006-06-12 Thread tomass

It seems to be related to this in my models:

from django.contrib.auth.models import User

class Email(models.Model):
  owner = models.ForeignKey(User)
  ...
  ...

If I comment out this line, I'm good. What's am I doing wrong here?


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users
-~--~~~~--~~--~--~---



User editing/adding broken in Admin interface

2006-06-12 Thread tomass

Hi Folks,

Can anyone help out with a broken part of the admin interface? I get
this message if I try to edit a user:

AttributeError at /admin/auth/user/1/
'bool' object has no attribute 'get'
Request Method: GET
Request URL:http://example.com/admin/auth/user/1/
Exception Type: AttributeError
Exception Value:'bool' object has no attribute 'get'
Exception Location:

/usr/lib/python2.4/site-packages/Django-0.91-py2.4.egg/django/db/models/related.py
in get_manipulator_fields, line 111

/usr/lib/python2.4/site-packages/Django-0.91-py2.4.egg/django/db/models/related.py
in get_manipulator_fields

 105. count = self.field.rel.num_in_admin
 106. else:
 107. count = 1
 108.
 109. fields = []
 110. for i in range(count):
 111. for f in self.opts.fields + self.opts.many_to_many:

 112. if follow.get(f.name, False): ...

 113. prefix = '%s.%d.' % (self.var_name, i)
 114. fields.extend(f.get_manipulator_fields(self.opts, manipulator,
change,
 115. name_prefix=prefix, rel=True))
 116. return fields
 117.
 118. def __repr__(self):

Thanks, Tom


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users
-~--~~~~--~~--~--~---



Re: Presenting information from an external system

2006-06-09 Thread tomass

Another approach might be to simply run this as an independent process
(from cron, or whatever) and use django's ORM from within that script
to update the database which can then be viewed in your web app.

I've done this quite successfully with some of my apps.


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users
-~--~~~~--~~--~--~---



Re: Admin's User edit broken

2006-06-09 Thread tomass

I should mention that I got this error when running syncdb:

Error: None couldn't be installed, because there were errors in your
model:
provisioning.email: At least one field in Email should have core=True,
because it's being edited inline by user.User.

Here's the appropriate models.py:

from django.db import models
from django.contrib.auth.models import User

class Email(models.Model):
emailoneto = models.TextField()
emailonesubject = models.CharField(maxlength=255)
emailtwoto = models.TextField()
emailtwosubject = models.CharField(maxlength=255)
emailbody = models.TextField()
ticket_id = models.IntegerField()
created_date = models.DateTimeField(auto_now_add=True)
sent_date = models.DateTimeField(blank=True, null=True)
owner = models.ForeignKey(User)

def __str__(self):
return self.emailsubject

class Meta:
ordering = ['-sent_date', 'emailonesubject']


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users
-~--~~~~--~~--~--~---



Admin's User edit broken

2006-06-09 Thread tomass

Hi Folks,

I just deleted a Group, and now whenever I try to edit a user within
the admin interface I get the following error message:

AttributeError at /opscenter/admin/auth/user/3/
'bool' object has no attribute 'get'
Request Method: GET
Request URL:
http://cscenter.uk.scansafe.com/opscenter/admin/auth/user/3/
Exception Type: AttributeError
Exception Value:'bool' object has no attribute 'get'
Exception Location:
/usr/lib/python2.3/site-packages/django/db/models/related.py in
get_manipulator_fields, line 111

Any help appreciated.

Thanks, Tom


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users
-~--~~~~--~~--~--~---



Re: How to debug MySQLdb issues

2006-06-09 Thread tomass

Works a treat. Compiled from source...

Thanks, Tom


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users
-~--~~~~--~~--~--~---



Re: How to debug MySQLdb issues

2006-06-09 Thread tomass

I'll give that a try. Any ideas why it would work from the python
interpreter and not from Django?

I'll update on whether the suggested MySQL-python-1.2.1 fixes it.

Thanks for the response.

Tom


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users
-~--~~~~--~~--~--~---



How to debug MySQLdb issues

2006-06-09 Thread tomass

Hi Folks,

I'm using PostgreSQL for my local database, but my application connects
to a number of other databases to do some queries. I have written a DB
abstraction module which I use to connect to PostgreSQL, MySQL and
Oracle, which has worked fine for me in all situations (Django and
otherwise) that I've used it for to date.

I have been testing on an Ubuntu desktop and my app works fine, but
I've now migrated it to Fedora Core 3 where it will be in production
and I'm having problems. I think the problem is related to the fact
that I have custom RPMs for MySQL (using the 5.0 ones for RHEL3 from
MySQL's website), but am using the generic MySQL-python RPM for FC3.

If I'm on the command line, I can do this:

from myproject.utils.DB import DB
mysqlconn = DB(DB_TYPE, DB_NAME, DB_HOST, DB_PORT, DB_USER, DB_PASS)

and run queries like this

mysqlconn.DictResult(sql)

But from within Django if I try to import the module, it just returns
no output, or rather I get this:



Can anyone help me out with how to troubleshoot what's going on here,
since the import does work from the command line, I've checked the
permissions for everything, and it works fine, and it also works fine
in my dev environment, just not in production??

Thanks, Tom


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users
-~--~~~~--~~--~--~---



Re: Change cols and row in generic update page textarea

2006-06-06 Thread tomass

Thanks!


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users
-~--~~~~--~~--~--~---



Re: Change cols and row in generic update page textarea

2006-06-06 Thread tomass

But how do I show the value of the field in the textarea:

is there such as thing as {{ form.emailbody.value }} or something? This
is for an update form, so I need to display the current value

Thanks, Tom


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users
-~--~~~~--~~--~--~---



Re: Change cols and row in generic update page textarea

2006-06-06 Thread tomass

This is for a generic view. I may have missed this in the doc, but how
do I specify my html?

I'm currently doing:

EmailBody: {{ form.emailbody }}
{% if form.emailbody.errors %}*** {{ form.emailbody.errors|join:",
" }}{% endif %}

And this is what punches out the:



How can I control what cols and rows this outputs?

Thanks, Tom


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users
-~--~~~~--~~--~--~---



Change cols and row in generic update page textarea

2006-06-06 Thread tomass

Hi Folks,

Wondering if there's a way to specify how many rows and columns the
generic update page uses for a textarea?

It seems to default to 10 and 40, and I'd like to make this much
larger.

Thanks, Tom


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users
-~--~~~~--~~--~--~---



Re: Dynamic template extension

2006-05-31 Thread tomass

Great, this seems to work a treat!

Thanks, Tom


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users
-~--~~~~--~~--~--~---



Dynamic template extension

2006-05-30 Thread tomass

Hi Folks,

I'm wondering if there's a way to include dynamic (context) data in an
{% extends %} statement.

I don't seem to be able to do {% extends "base_{{ reseller }}_.html" %}
for instance.

Thanks, Tom


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users
-~--~~~~--~~--~--~---



Post data for multi step form

2006-05-20 Thread tomass

Hi Folks,

I'm sure there's a better solution for this, just not sure what it
is...

I have a 4 step form and I'm currently capturing all posted data
between each step and then re-posting it through hidden input fields
and recapturing it at each successive step. URL redirects won't quite
work for me as a better solution, since I have so much data that I
don't want to show what all of that is in the URL such as:



for instance.

What's the more elegant solution for this?

Thanks, Tom


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users
-~--~~~~--~~--~--~---



Re: Runserver from 0.95 problems

2006-05-13 Thread tomass

Found it. I had an old install that was overriding the settings. Not
exactly sure how as it wasn't in the sys.path, but in any case I've
moved the old directory and now it's all good.

Thanks, Tom


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users
-~--~~~~--~~--~--~---



Re: Runserver from 0.95 problems

2006-05-13 Thread tomass

As you can see from my installed apps above, I don't have
django.contrib.admin in there yet, and so the first item is satisfied.
Also, I don't have django.contrib.flatpages or
django.contrib.redirects.

And in any case, I am using django-admin.py to generate all of this -
I'm not modifying anything.

Thanks, Tom


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users
-~--~~~~--~~--~--~---



Re: Runserver from 0.95 problems

2006-05-12 Thread tomass

Okay, so I try python manage.py syncdb and I get:

Error: None couldn't be installed, because there were errors in your
model:
admin.logentry: 'user' has relation with uninstalled model User
admin.logentry: 'content_type' has relation with uninstalled model
ContentType

Here is the contents of my INSTALLED_APPS:

INSTALLED_APPS = (
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.sites',
)

I tried adding in django.contrib.admin but that didn't seem to work.

Thanks, Tom


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users
-~--~~~~--~~--~--~---



Runserver from 0.95 problems

2006-05-12 Thread tomass

Installed from subversion. Ran "django-admin.py startproject
greenleaftech; cd greenleaftech; python manage.py runserver" and I get
the following. Can anyone help out?

Thanks, Tom


python manage.py runserver
Validating models...
admin.logentry: 'user' has relation with uninstalled model User
admin.logentry: 'content_type' has relation with uninstalled model
ContentType
2 errors found.

Django version 0.95 (post-magic-removal), using settings
'greenleaftech.settings'
Development server is running at http://127.0.0.1:8000/
Quit the server with CONTROL-C.


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users
-~--~~~~--~~--~--~---



Re: Flatpages shows "FlatPage object" instead of friendly name

2006-05-11 Thread tomass

Great, glad to help out!!


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users
-~--~~~~--~~--~--~---



Flatpages shows "FlatPage object" instead of friendly name

2006-05-11 Thread tomass

In the Flatpages list in the admin interface by default I see "FlatPage
object" instead of, for instance, the title or URL field.

Ditto with Sites.

Is this supposed to be this way? I realize I could create a wrapper
around the object and use a def __repr__(self) to take care of this,
but just wondering...

Thanks, Tom


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users
-~--~~~~--~~--~--~---



ifequal string with spaces

2006-05-10 Thread tomass

Hi Folks,

I'm not sure if this is a bug, but it seems like if I do a test with {%
ifequal %} for a string with spaces in it, I get a TemplateSyntaxError:
'ifequal' takes two arguments. Here's my code:

{% for tower in towers %}
{% ifequal tower.country "United Kingdom" %}
document.towers.elements[{{ forloop.counter0 }}].checked = 1;
{% endifequal %}
{% endfor %}

However, this seems to work fine (except that obviously it doesn't do
what I want it to do):

{% for tower in towers %}
{% ifequal tower.country "UnitedKingdom" %}
document.towers.elements[{{ forloop.counter0 }}].checked = 1;
{% endifequal %}
{% endfor %}

Thanks, Tom


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users
-~--~~~~--~~--~--~---



Re: Accessing request.user in urls.py

2006-05-09 Thread tomass

Great, thanks.


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users
-~--~~~~--~~--~--~---



Accessing request.user in urls.py

2006-05-09 Thread tomass

Hi Folks,

The subject says it, really. Is there any way to access the
request.user in the urls.py. Basically I want to pass the current
user's id as an option to a generic view. I have a field in my model
which is a ForeignKey on User, so each instance of the model is
associated with a specific user, and I want to filter the results to
only show a specific user.

I realise I could do this in the template itself, but would like to do
it here so the query is smaller and more effecient.

Thanks, Tom


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users
-~--~~~~--~~--~--~---



Re: Permissions question

2006-05-09 Thread tomass

So I decided the easiest way to do this was to add this to the top of
my model:

from django.contrib.auth.models import Group

and then adding this to my class:

group_perm = models.ManyToManyField(Group)

Thanks, Tom


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users
-~--~~~~--~~--~--~---



Re: Template Tags in MR

2006-05-08 Thread tomass

No, never have


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users
-~--~~~~--~~--~--~---



Re: Subclassing question

2006-05-08 Thread tomass

You may need to define the return value with the following:

def __repr__(self):
return "%s" % ('Whatever value you want to return, such as
self.name')


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users
-~--~~~~--~~--~--~---



Permissions question

2006-05-08 Thread tomass

Hi Folks,

So I have a question about how best to implement a permission structure
for an app I'm writing.

The app is a way of automating running commands on different servers.
So my command model looks like this:

class Command(models.Model):
command_type = models.ForeignKey(CommandType)
name = models.CharField(maxlength=200)
command = models.TextField()
description = models.TextField(blank=True, null=True)

Basically, what I want is to be able to control which users can run
which commands using the Django user/group setup. So, for instance I
could create a group called "Ops" and then assign which commands that
group has access to, and a group called "Customer Service" and give
them access to a different set of commands.

I don't think the permissions structure is quite flexible enough for
this, as I think I would need to create a new permission for each
group, right? And this would only be tied to the Django auth_group in
my code, not in any other way. But maybe this is the only way of doing
it?

My other thought was to create a separate model called CommandPerm and
then have a foreign key in the command field and then in my code assign
certain groups access to certain CommandPerm entries. Seems a little
clunky as well, though. 

Any thoughts appreciated.

Thanks, Tom


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users
-~--~~~~--~~--~--~---



Re: Template Tags in MR

2006-05-03 Thread tomass

Hi Adrian,

I get no output/error messages when I try python automator.py.

Here's the contents of the file:


from django import template

register = template.Library()

@register.filter
def bash_special(value):
value = value.replace('[00;34m', '')
return value
-

Not quite sure what I'm missing here...

Thanks, Tom


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users
-~--~~~~--~~--~--~---



Template Tags in MR

2006-05-02 Thread tomass

Hi Folks,

Just having a few problems getting custom template tags working in MR.

I think I'm supposed to create a directory called templatetags in the
directory that holds my models.py, then drop an __init__.py file into
there and the file I want to import (in my case automator.py).

However, I get this error message:

'opscenter' is not a valid tag library: Could not load template library
from django.templatetags.automator, No module named automator

How do I tell it to look in this directory for my automator.py instead
of django.templatetags.automator?

Thanks, Tom


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users
-~--~~~~--~~--~--~---



Different versions of Django - apache virtual hosts

2006-04-28 Thread tomass

Hi Folks,

Just wondering how I configure an apache virtual host to use a
different version of Django. I've installed the magic-removal branch
and have added the following to my virtual host config file, but I'm
still getting an error message which indicates that it's using the 0.91
version of Django.


ServerName example.com
DocumentRoot /var/www/html/example/html

SetEnv PYTHONPATH /home/mthaddon/django/magic-removal
SetHandler python-program
PythonHandler django.core.handlers.modpython
SetEnv DJANGO_SETTINGS_MODULE opscenter.settings
PythonDebug On


SetEnv PYTHONPATH /home/mthaddon/django/magic-removal
SetHandler python-program
PythonHandler django.core.handlers.modpython
SetEnv DJANGO_SETTINGS_MODULE opscenter.settings
PythonDebug On



Thanks, Tom


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users
-~--~~~~--~~--~--~---



Re: Magic Removal syncdb error

2006-04-28 Thread tomass

Thanks! Tom


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users
-~--~~~~--~~--~--~---



Re: Magic Removal syncdb error

2006-04-28 Thread tomass

Hi Malcolm,

Thanks! I'm not getting that error any more, but am getting this:

Error: None couldn't be installed, because there were errors in your
model:
admin.logentry: 'user' has relation with uninstalled model User
admin.logentry: 'content_type' has relation with uninstalled model
ContentType

Is the syncdb meant to replace the init, or is there something else I
should be doing, as it looks like it's not creating the user and
content_type tables/models for me.

My installed apps is:

INSTALLED_APPS = (
'opscenter.automator',
'django.contrib.admin',
)

And if I do python manage.py validate I get:

admin.logentry: 'user' has relation with uninstalled model User
admin.logentry: 'content_type' has relation with uninstalled model
ContentType
2 errors found.

Thanks, Tom


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users
-~--~~~~--~~--~--~---



Re: Forking a new process

2006-04-28 Thread tomass

You know, I actually tried JobControl, and it looked like it was going
to do exactly what I was after, but it seemed to be created extra
processes that weren't being terminated correctly (for each "job" I
kicked off, there were 2 extra apache processes). In the end I went
with the idea of an independent backend. Very easy to do, and gives me
a little more flexibility as well.

Thanks, Tom


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users
-~--~~~~--~~--~--~---



Re: Magic Removal syncdb error

2006-04-28 Thread tomass

Sure, here it is:

from django.db import models
import datetime

SERVER_STATUS_CHOICES = (
('A', 'Active'),
('I', 'Inactive'),
)

COUNTRY_CHOICES = (
('UK', 'United Kingdom'),
('US', 'United States'),
)

class Country(models.Model):
country_name = models.CharField(maxlength=2)

def __repr__(self):
return self.country_name

class Admin:
pass

class Region(models.Model):
region_name = models.CharField(maxlength=200)

def __repr__(self):
return self.region_name

class Admin:
pass

class Datacenter(models.Model):
datacenter_name = models.CharField(maxlength=200)
location = models.CharField(maxlength=200)
country = models.CharField(maxlength=200, choices=COUNTRY_CHOICES)

def __repr__(self):
return self.datacenter_name

class Admin:
pass

class TowerUsage(models.Model):
usage = models.CharField(maxlength=200)
comment = models.TextField(blank=True, null=True)

def __repr__(self):
return self.usage

class Admin:
pass

class Tower(models.Model):
tower_name = models.CharField(maxlength=200)
country = models.ForeignKey(Country)
region = models.ForeignKey(Region, blank=True, null=True)
datacenter = models.ForeignKey(Datacenter)
usage = models.ForeignKey(TowerUsage, blank=True, null=True)

def __repr__(self):
return self.tower_name

class Admin:
pass

class TowerAlias(models.Model):
tower = models.ForeignKey(Tower)
tower_alias = models.CharField(maxlength=200)

def __repr__(self):
return self.tower_alias

class Admin:
list_display = ('tower', 'tower_alias'),
list_filter = ['tower'],

class Server(models.Model):
tower = models.ForeignKey(Tower)
server_name = models.CharField(maxlength=200)
internal_ip = models.IPAddressField()
external_ip = models.IPAddressField(blank=True, null=True)
status = models.CharField(maxlength=1,
choices=SERVER_STATUS_CHOICES, default='A')

def __repr__(self):
return self.server_name

class Admin:
list_display = ('tower', 'server_name'),
list_filter = ['tower'],


class CommandType(models.Model):
command_type = models.CharField(maxlength=200)

def __repr__(self):
return self.command_type

class Admin:
pass

class Command(models.Model):
command_type = models.ForeignKey(CommandType)
name = models.CharField(maxlength=200)
command = models.TextField()
description = models.TextField(blank=True, null=True)

def __repr__(self):
return self.command

class Admin:
ordering = ['name']
list_display = ('name', 'command', 'command_type'),
list_filter = ['command_type'],

class CommandOptions(models.Model):
command = models.ForeignKey(Command)
option_order = models.IntegerField()
description = models.CharField(maxlength=200)

def __repr__(self):
return self.description

class Admin:
ordering = ['option_order']
list_display = ('command', 'option_order', 'description'),
list_filter = ['command'],

class CommandLog(models.Model):
fullcommand = models.TextField()
command_type = models.ForeignKey(CommandType)
host = models.IPAddressField()
command_time = models.DateTimeField(blank=True, null=True)
command_output = models.TextField(blank=True, null=True)
date_to_run = models.DateTimeField(default=datetime.datetime.now())
priority = models.IntegerField(default=10)
completed = models.BooleanField(default=False)

def __repr__(self):
return self.fullcommand

def show_future(self):
future = objects.filter(completed=False,
date_to_run__gt=datetime.datetime.now())
return future

def show_outstanding(self):
outstanding = objects.filter(completed=False,
date_to_run__lt=datetime.datetime.now())
return outstanding

class Admin:
ordering = ['-command_time']
list_display = ('fullcommand', 'host', 'command_time',
'completed'),
list_filter = ['completed'],


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users
-~--~~~~--~~--~--~---



Magic Removal syncdb error

2006-04-28 Thread tomass

Hi Folks,

I'm trying out the magic-removal branch, and am trying to just create
my database from scratch. When typing "python manage.py syncdb" I get:

Traceback (most recent call last):
  File "../../django/magic-removal/django/bin/django-admin.py", line 5,
in ?
management.execute_from_command_line()
  File "/home/mthaddon/django/magic-removal/django/core/management.py",
line 1152, in execute_from_command_line
action_mapping[action]()
  File "/home/mthaddon/django/magic-removal/django/core/management.py",
line 943, in validate
num_errors = get_validation_errors(outfile)
  File "/home/mthaddon/django/magic-removal/django/core/management.py",
line 887, in get_validation_errors
f = opts.get_field(fn)
  File
"/home/mthaddon/django/magic-removal/django/db/models/options.py", line
97, in get_field
raise FieldDoesNotExist, "name=%s" % name
TypeError: not all arguments converted during string formatting

Can anyone help out with this?

Thanks, Tom


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users
-~--~~~~--~~--~--~---



Re: Forking a new process

2006-04-25 Thread tomass

Well, basically I have processes that could take minutes to execute,
and I'd like to background them, serve up a page showing the status,
and then allow users to view the output once they've completed.

Thanks, Tom


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users
-~--~~~~--~~--~--~---



Forking a new process

2006-04-25 Thread tomass

Hi Folks,

I'm trying to fork a new process using os.fork(), and everything seems
to be working well, except that I need to then reference django models
from the forked process. This seems to mean I need to reimport all the
relevant modules into the function that's running as a forked process,
and I'm then getting an error as follows:

server closed the connection unexpectedly
This probably means the server terminated abnormally
before or while processing the request.

SET TIME ZONE 'Europe/London'

This seems to happen whenever I try to use the DB api. Here's an
example of the import that works, but then a DB lookup that fails.

from django.models.opsdashboard import commands, commandtypes
command = str(commands.get_object(pk=command_id))

Do I need to import something else as well. I would have thought if I'm
importing the models, I'm all good?

Any help appreciated,

Thanks, Tom


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users
-~--~~~~--~~--~--~---



Re: ifequal issues

2006-03-13 Thread tomass

Great, thanks! I thought it might be something like this. Should have
dug a little deeper...


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users
-~--~~~~--~~--~--~---



ifequal issues

2006-03-13 Thread tomass

Hi Folks,

I'm having some issues with {% ifequal %}. What I'm trying to do is
have a drop down list remember the values that are sent on a get
request that is sent to the same page. I pass the value of the variable
(show_only in this case) back to the template, and then I have this
statement in the  section:

{% for job in jobs_list %}
{% filter escape %}{{ job.shortsubject }}{% endfilter
%}
{% endfor %}

Problem is, even when show_only is, for example, 2, and job.id is also
2 the ifequal statement doesn't seem to recognize that and is not
showing the crucial "selected" html which allows the drop down list to
"remember" the values that it should be doing.

Is this something related to numerical values (both are supposed to be
numerical values? 

Thanks, Tom


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users
-~--~~~~--~~--~--~---



Re: CSS issues

2006-03-11 Thread tomass

Great, works a treat!

Thanks so much

Tom


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users
-~--~~~~--~~--~--~---



CSS issues

2006-03-09 Thread tomass

Hi Folks,

I've copied the admin css to be used for my views, but I've added in
this custom section which is a modified version of the FILTER COLUMN
from changelist.css:

/*  FILTER COLUMN  (CUSTOM VERSION) */

#changelist-filter-custom {position:absolute; top:0; right:0;
width:180px; border-left:1px solid #ddd; background:#efefef; margin:0;}
#changelist-filter-custom h2 {font-size:11px; padding:2px 5px;
border-bottom:1px solid #ddd;}
#changelist-filter-custom h3 {font-size:12px; margin-bottom:0;}
#changelist-filter-custom ul
{padding-left:0;margin-left:10px;_margin-right:-10px;}
#changelist-filter-custom li {list-style-type:none; margin-left:0;
padding-left:0;}
#changelist-filter-custom a {color:#999;}
#changelist-filter-custom a:hover {color:#036;}
#changelist-filter-custom li.selected {border-left:5px solid #ccc;
padding-left:5px;margin-left:-10px;}
#changelist-filter-custom li.selected a {color:#5b80b2 !important;}

Basically what I've changed is the width in the first item (from 160px
to 180px, as well as removing the z-index so that a custom calendar
item pops up okay. Problem now is best illustrated with a picture:
http://www.greenleaftech.net/members/mthaddon/django_css
As you can see I have some trailing non-aligned part of the filtered
list, and the last column of the table gets run into the filtered list
at the top.

Can anyone help out with some css magic?

Thanks, Tom


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users
-~--~~~~--~~--~--~---



Re: Can't import view

2006-03-07 Thread tomass

Thanks! Bit of a duffer with that one...


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users
-~--~~~~--~~--~--~---



Can't import view

2006-03-06 Thread tomass

Hi Folks,

I have an application that I'd written in an older version of Django
that I'm upgrading to 0.91 and for some reason I'm having problems with
the views.

Here's an excerpt from my urls.py

(r'^admin/', include('django.contrib.admin.urls.admin')),
(r'^jobmonitor/$', include('greenleaftech.jobmonitor.views.index')),

And here's the contents of greenleaftech/jobmonitor/views (without the
import statements):


def index(request):
return HttpResponse("Hello, world. You're at the jobmonitor
index.")

And I get this error if I go to /jobmonitor/


ImportError at /jobmonitor/
No module named index
Request Method: GET
Request URL:http://jobmonitor.greenleaftech.net/jobmonitor/
Exception Type: ImportError
Exception Value:No module named index
Exception Location:

/usr/lib/python2.4/site-packages/Django-0.91-py2.4.egg/django/core/urlresolvers.py
in _get_urlconf_module, line 87

Am I missing something basic here? I'm serving this from Apache which
has the DJANGO_SETTINGS_MODULE configured, and the admin interface
works fine. If I drop into the python shell and do from
greenleaftech.jobmonitor.views import index it works fine.

Thanks, Tom


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users
-~--~~~~--~~--~--~---



Customizing the admin interface

2006-03-03 Thread tomass

Hi Folks,

I think there are two ways of doing what I want to do. Essentially what
I want to do is be able to have read-only tables in the admin interface
(these tables get populated from an external app), but I'd like the
flexibility to be able to view the data in them from within the admin
application.

I realize that the obvious answer would be to just create generic views
for them. This may be the way to go, but I like many of the features of
the admin inteface:

- the user and group permission setup, for instance, so I can control
who can view the tables.
- the filter by and search options (although I'd like to be able to
filter by two fields and don't seem to be able to do that, and the
search field doesn't seem to display the field you're searching on
which may be a little confusing for the user).

Can anyone point me in the direction of whether I really should just go
with generic views (and if there's an easy way to include the search
and filter options), or if there is a "read-only" option in the admin
console that I'm missing.

Thanks, Tom


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users
-~--~~~~--~~--~--~---



Re: manage.py vs. django-admin.py

2006-02-28 Thread tomass

Thanks, that seemed to do it.


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users
-~--~~~~--~~--~--~---



manage.py vs. django-admin.py

2006-02-24 Thread tomass

Hi Folks,

I have /usr/local/lib/python2.4/site-packages in my sys.path. I've
added a symlink from my project directory
(/home/mthaddon/jmon_code/jobmonitor) to
/usr/local/lib/python2.4/site-packages/jobmonitor and in this folder I
have the settings.py, manage.py and urls.py as well as my app directory
(also named jobmonitor), which then has a models folder with
jobmonitor.py in it.

If I run python manage.py sql jobmonitor I get:

Traceback (most recent call last):
  File "manage.py", line 11, in ?
execute_manager(settings)
  File
"/usr/lib/python2.4/site-packages/Django-0.91-py2.4.egg/django/core/management.py",
line 990, in execute_manager
execute_from_command_line(action_mapping)
  File
"/usr/lib/python2.4/site-packages/Django-0.91-py2.4.egg/django/core/management.py",
line 903, in execute_from_command_line
translation.activate('en-us')
  File
"/usr/lib/python2.4/site-packages/Django-0.91-py2.4.egg/django/utils/translation.py",
line 192, in activate
_active[currentThread()] = translation(language)
  File
"/usr/lib/python2.4/site-packages/Django-0.91-py2.4.egg/django/utils/translation.py",
line 111, in translation
from django.conf import settings
  File
"/usr/lib/python2.4/site-packages/Django-0.91-py2.4.egg/django/conf/settings.py",
line 34, in ?
raise EnvironmentError, "Could not import %s '%s' (is it on
sys.path?): %s" % (ENVIRONMENT_VARIABLE, me.SETTINGS_MODULE, e)
EnvironmentError: Could not import DJANGO_SETTINGS_MODULE
'jobmonitor.settings' (is it on sys.path?): No module named settings

So, I tried doing django-admin.py sql jobmonitor and got

Traceback (most recent call last):
  File "/usr/bin/django-admin.py", line 5, in ?
pkg_resources.run_script('Django==0.91', 'django-admin.py')
  File
"/usr/lib/python2.4/site-packages/setuptools-0.6a9-py2.4.egg/pkg_resources.py",
line 407, in run_script
self.require(requires)[0].run_script(script_name, ns)
  File
"/usr/lib/python2.4/site-packages/setuptools-0.6a9-py2.4.egg/pkg_resources.py",
line 920, in run_script
execfile(script_filename, namespace, namespace)
  File
"/usr/lib/python2.4/site-packages/Django-0.91-py2.4.egg/EGG-INFO/scripts/django-admin.py",
line 5, in ?
management.execute_from_command_line()
  File
"/usr/lib/python2.4/site-packages/Django-0.91-py2.4.egg/django/core/management.py",
line 903, in execute_from_command_line
translation.activate('en-us')
  File
"/usr/lib/python2.4/site-packages/Django-0.91-py2.4.egg/django/utils/translation.py",
line 192, in activate
_active[currentThread()] = translation(language)
  File
"/usr/lib/python2.4/site-packages/Django-0.91-py2.4.egg/django/utils/translation.py",
line 111, in translation
from django.conf import settings
  File
"/usr/lib/python2.4/site-packages/Django-0.91-py2.4.egg/django/conf/settings.py",
line 29, in ?
raise EnvironmentError, "Environment variable %s is undefined." %
ENVIRONMENT_VARIABLE
EnvironmentError: Environment variable DJANGO_SETTINGS_MODULE is
undefined.

So, I did export DJANGO_SETTINGS_MODULE='jobmonitor.settings' and now
the django-admin.py command works but not the manage.py. Can someone
explain what I'm missing here?

Also, the output of the django-admin.py sql jobmonitor command includes
a number of tables like this:

CREATE TABLE "auth_users_user_permissions" (
"id" serial NOT NULL PRIMARY KEY,
"id" integer NOT NULL,
"user_id_id" integer NOT NULL REFERENCES "auth_users" ("id"),
"permission_id_id" integer NOT NULL REFERENCES "auth_permissions"
("id")
);

i.e. with two "id" fields. 

Can anyone help?


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users
-~--~~~~--~~--~--~---



Date issues

2005-11-07 Thread tomass

I'm getting the following error when I try to upload a photo:

File "/usr/lib/python2.3/site-packages/django/core/meta/fields.py",
line 327, in get_db_prep_save
value = value.strftime('%Y-%m-%d')

AttributeError: 'str' object has no attribute 'strftime'

Here's my model:

from django.core import meta

class Weblog(meta.Model):
  subject = meta.CharField(maxlength=200)
  date_created = meta.DateTimeField('date created', auto_now_add=True)
  last_updated = meta.DateTimeField('last updated', auto_now=True)
  log_text = meta.TextField()
  class META:
admin = meta.Admin(
)
  def __repr__(self):
return self.subject

class Photocategory(meta.Model):
  category = meta.CharField(maxlength=255)
  class META:
admin = meta.Admin(
)
  def __repr__(self):
return self.category

class Photo(meta.Model):
  weblog = meta.ForeignKey(Weblog, null=True)
  category = meta.ForeignKey(Photocategory, null=True)
  photo =
meta.ImageField(upload_to="/home/mthaddon/tomhaddon/content/photos/%m_%y/")
  date_uploaded = meta.DateField('date uploaded', auto_now_add=True)
  photo_date = meta.DateField('photo date')
  photo_description = meta.TextField()
  class META:
admin = meta.Admin(
)
  def __repr__(self):
return self.photo_description


I think what I'm seeing is a problem with converting something to a
date? Is this correct?

Thanks, Tom



Re: Tag library not found

2005-10-20 Thread tomass

Works a treat, thanks!

Wonder if you've had a chance to take a look at this:
http://code.djangoproject.com/ticket/480#preview

Still seems to be bothering me... 

Thanks, Tom



Tag library not found

2005-10-19 Thread tomass

Hi Folks,

Getting this strange error message on my admin login.

  File
"/usr/lib/python2.4/site-packages/django/core/template/defaulttags.py",
line 627, in do_load
raise TemplateSyntaxError, "'%s' is not a valid tag library" %
taglib

TemplateSyntaxError: 'auth.log' is not a valid tag library


If I go to the login page for the admin console it comes up fine, as
does any non-admin page, but when I'm logged in I get this error. I did
a grep for auth.log and it seems to be loaded in the index.html
template of the admin pages.

Should mention that I've just upgraded to the latest version.

Thanks, Tom