Re: Help with a custom tag

2006-03-03 Thread akaihola

It seems you can also say
{{item.list.0}} = {{item.list.1}}


--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



An expression tag

2006-03-03 Thread limodou

I'v written a expression tag, it can be used to calculate python
expression and save the result to a template variable. I think it
maybe some useful for someone.

---utiltags.py---
from django import template
import re

register = template.Library()

class ExprNode(template.Node):
def __init__(self, expr_string, var_name):
self.expr_string = expr_string
self.var_name = var_name

def render(self, context):
clist = list(context)
clist.reverse()
d = {}
for c in clist:
d.update(c)
context[self.var_name] = eval(self.expr_string, d)
return ''

def do_expr(parser, token):
try:
# Splitting by None == splitting by spaces.
tag_name, arg = token.contents.split(None, 1)
except ValueError:
raise template.TemplateSyntaxError, "%r tag requires
arguments" % token.contents[0]
m = re.search(r'(.*?) as (\w+)', arg)
if not m:
raise template.TemplateSyntaxError, "%r tag had invalid
arguments" % tag_name
expr_string, var_name = m.groups()
return ExprNode(expr_string, var_name)
do_expr = register.tag('expr', do_expr)

-How to use it-
{% load utiltags %}
{% expr 1 as a %}
{% expr 2 as b %}
{% expr a+b as c %}
{{ a }}+{{ b }}={{ c }}

--
I like python!
My Blog: http://www.donews.net/limodou
NewEdit Maillist: http://groups.google.com/group/NewEdit

--~--~-~--~~~---~--~~
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: Django in Boo

2006-03-03 Thread wizeman

Jeremy Dunck wrote:
> IronPython -is- Python, runs on .Net, and is coming along nicely.

Yes, IronPython is also cool. You know when you look at something and
you say - wow, this is a great idea and it would be great if everyone
realizes that? I had that feeling with Python right away, but only in
the last few years it started to be considered a "real" language.

One thing that I consider a good idea is static typing combined with
type inference. It just makes for good programming practice and doesn't
require verbose syntax. You can do things like:

def f(y as int):
x = y * 3
return x + y

and the compiler figures out the type of 'x' and the return type of
'f()' automatically, or you can specify it yourself if you want to. And
it can catch a lot of errors, especially in big projects.

Another thing that I consider a great idea is programming by contract,
and while it isn't part of Boo, it can be cleanly done with syntax
macros.

But anyway, this is getting off-topic and I don't want to bore you.
 I wanted to raise some awareness of the language and maybe get you to
check it out.
Or you can ignore it, as long as you have fun in coding... :)


--~--~-~--~~~---~--~~
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: Django in Boo

2006-03-03 Thread Jeremy Dunck

On 3/3/06, wizeman <[EMAIL PROTECTED]> wrote:
>
> Ok, I was thinking more in an academic perspective instead of a
> real-world one.
>
> Think about it. Python was an esoteric language in the beginning. And
> Boo isn't that esoteric, it can be thought of as an extension to the
> Python syntax.

IronPython -is- Python, runs on .Net, and is coming along nicely.

--~--~-~--~~~---~--~~
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: Django in Boo

2006-03-03 Thread wizeman

Ok, I was thinking more in an academic perspective instead of a
real-world one.

Think about it. Python was an esoteric language in the beginning. And
Boo isn't that esoteric, it can be thought of as an extension to the
Python syntax.
And virtually all .NET libraries can be used in Boo, it runs on the
.NET/Mono runtime.

Well, I guess there aren't many Boo fans (yet) ;)

If only I made web pages for a living.. *sniff*


--~--~-~--~~~---~--~~
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: Puzzling META.unique_together issue

2006-03-03 Thread Bo Shi

Sorry - some edit_inline, etc. got cut off in the paste.


--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



Puzzling META.unique_together issue

2006-03-03 Thread Bo Shi

Hi, three models that concern this issue are Photo, Tag, and PhotoTag.
Tag represents the model for all tags:

class PhotoTag( meta.Model ):
tid = meta.ForeignKey( Tag, core = True )
pid = meta.ForeignKey( Photo, core = True, verbose_name = "Photo
Tag", edit_

class META:
# following prevents identical tags on photo TODO: doesn't work
unique_together = ( ( "tid", "pid" ), )


Results in the following exception.  Is unique_together not allowed on
ForeignKeys?  If so, can anyone suggest a workaround?


  File "/usr/lib/python2.3/site-packages/django/core/meta/__init__.py",
line 259,
 in get_manipulator_fields
fields.extend(f.get_manipulator_fields(self.opts, manipulator,
change, name_p
refix=prefix, rel=True))

  File "/usr/lib/python2.3/site-packages/django/core/meta/fields.py",
line 254, i
n get_manipulator_fields
params['validator_list'].append(getattr(manipulator, 'isUnique%s' %
'_'.join(
field_name_list)))

AttributeError: PhotoManipulatorAdd instance has no attribute
'isUniquetid_pid'


--~--~-~--~~~---~--~~
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: Ordering with respect to a function in models?

2006-03-03 Thread Luke Plant

On Friday 03 March 2006 01:01, Malcolm Tredinnick wrote:

> Unfortunately, Meta.ordering seems to want a real field, not a method
> (which Admin.list_display can take) or a property.
>
> So am I missing something, or is this even a common need for other
> people?

Meta.ordering does ordering in the database using an SQL 'ORDER BY' 
clause, so you can't use a function defined in your model to do that 
ordering.

A solution (or part of one) is available in magic-removal.  You can 
create your own custom manager, and it has a method get_query_set that 
you can override.  You could then create a subclass of QuerySet that 
has certain methods overridden to do ordering after the data is 
returned. (I think the one you'd need to override is 
QuerySet._get_data).  

The first 'Manager' to be defined is used as the default one, so your 
custom manager would work in the Admin and elsewhere.

There may still be issues in getting this to play well with other 
ordering, I'm not sure, but they should be fixable.

Luke

-- 
"The first ten million years were the worst. And the second ten 
million, they were the worst too. The third ten million, I didn't enjoy 
at all. After that I went into a bit of a decline." (Marvin the 
paranoid android)

Luke Plant || L.Plant.98 (at) cantab.net || http://lukeplant.me.uk/

--~--~-~--~~~---~--~~
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 implement admin's filter interface in my own view

2006-03-03 Thread sam

Hi there

I'd like to add the filter function to my own view much in the same way
admin interface does it - i.e. filter based on the values of multiple
model fields. I am puzzled how to define the URL pattern and how the
matched pattern data gets passed to the view. Let's say I have 3
fields, each field is a choice type. How do I define the URL to handle
all kinds of filtering combinations? It doesn't seem very obvious as I
may have 0/1/2/3 fields selected for filtering. If there are ready-made
example/wiki that'll be great!


--~--~-~--~~~---~--~~
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: Django in Boo

2006-03-03 Thread Eugene Lazutkin

wizeman wrote:
> 
> I think one of the big advantages is the static typing feature. It's
> great, because if you change a variable or method name (or type) in one
> of your classes, and forget to change the method calls in other
> classes, the error(s) would be caught at compile-time instead of
> run-time.
> 
> What do you think about this?
> It would be a great undertaking, but it would be awesome :)

One problem is going to be the Python Standard Library and bridge 
libraries to system-specific and 3rd-party features (e.g., web servers, 
databases), unless Boo solved it already. In general this is the problem 
for all esoteric languages irrespective of how cool they are. Another 
thing to consider is the payback of such transition. Unless you have 
some mission critical CPU constrained web applications, it doesn't worth it.

Thanks,

Eugene


--~--~-~--~~~---~--~~
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: not about Django, but about this list

2006-03-03 Thread Malcolm Tredinnick

On Fri, 2006-03-03 at 15:53 -0800, Glenn Tenney wrote:
> Does anyone have any idea why a couple of messages (such as the one
> I'm including below) from a couple of different people have several
> lines combined making it very tough to read   Or, more to the
> point, what can be done about this?

I believe it is a client-side (mail reader) issue, but I have heard of
this before. The thing that was different about the messages you are
seeing formatted strangely is that it was sent with a Content-transfer-
enoding of base64. When we had this reported as a problem in a product I
was working on a while back, we thought it might be that after base64-
decoding the string, the client mail reader does not then do line ending
conversion correctly or something like that (the decoded string has
Unix-style line endings, so would have to be converted on a Microsoft
system, for example).

Apart from that, no clue.

Cheers,
Malcolm


--~--~-~--~~~---~--~~
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: not about Django, but about this list

2006-03-03 Thread Jeremy Dunck

On 3/3/06, Glenn Tenney <[EMAIL PROTECTED]> wrote:
>
> Does anyone have any idea why a couple of messages (such as the one
> I'm including below) from a couple of different people have several
> lines combined making it very tough to read   Or, more to the
> point, what can be done about this?
>

The referenced message was properly formatted for me, suggesting that
the issue is with your client (or a munging relay on your side).

--~--~-~--~~~---~--~~
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: Django in Boo

2006-03-03 Thread Jeremy Dunck

On 3/3/06, Tom Tobin <[EMAIL PROTECTED]> wrote:
> Err, knock yourself out porting it if you want (as it's BSD licensed
> after all), but I don't think you'll see many of us jumping to switch
> from Python anytime soon.  ;-)

That's a much more measured response than my initial one (which I was
smart enough not to send). ;-)

--~--~-~--~~~---~--~~
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: Django in Boo

2006-03-03 Thread Eric Walstad

On Friday 03 March 2006 14:45, wizeman wrote:
> If you don't know Boo, here are some of the main features:
>
> - Python-like syntax
> - Power of static typing with the ease-of-use of type inference
> - It's compiled, so type mismatches are caught right after changing
> something
> - It runs on the Mono runtime (CLR), which is faster than the Python
> implementation
> - Extendable through macros
> - It can use any .NET/Mono libraries
> - Etc
>
> I think one of the big advantages is the static typing feature. It's
> great, because if you change a variable or method name (or type) in one
> of your classes, and forget to change the method calls in other
> classes, the error(s) would be caught at compile-time instead of
> run-time.


Boo, Hiss

:)

I'm using Django *because* it's in Python.

--~--~-~--~~~---~--~~
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: exception while rendering

2006-03-03 Thread Malcolm Tredinnick

On Fri, 2006-03-03 at 17:12 -0600, Alan Bailey wrote:
> Hi there-
> 
> I am getting the following exception.  It doesn't show up in django's
> flashy exception display, but just as text (because it happens while
> rendering).
> 
> Dunno why it happens.  But it usually happens after I add some sort of
> relation information and then try to look at it through admin.
> 
> Has anyone else had this problem?  Lemme know.

Are you in a position to post the model you are using? Or can you create
a simple example that shows the same behaviour? At the moment, all
somebody can say is that there is a problem rendering the page. Since
you are using the admin pages when you see this error, it is going to be
more subtle than just a template syntax error, so it would be easier to
see what it is trying to display.

In particular, what does the Admin object look like for the models
involved?

Thanks,
Malcolm



--~--~-~--~~~---~--~~
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: Django in Boo

2006-03-03 Thread Tom Tobin
On 3/3/06, wizeman <[EMAIL PROTECTED]> wrote:
>
> Hi. I'm just starting to use Django and I'm loving it.
>
> Don't you think it would be great if Django was ported to Boo (
> http://boo.codehaus.org/ ) ?

Err, knock yourself out porting it if you want (as it's BSD licensed
after all), but I don't think you'll see many of us jumping to switch
from Python anytime soon.  ;-)

--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



exception while rendering

2006-03-03 Thread Alan Bailey

Hi there-

I am getting the following exception.  It doesn't show up in django's
flashy exception display, but just as text (because it happens while
rendering).

Dunno why it happens.  But it usually happens after I add some sort of
relation information and then try to look at it through admin.

Has anyone else had this problem?  Lemme know.

Alan

Traceback (most recent call last):

  File
"/usr/lib/python2.3/site-packages/Django-0.91-py2.3.egg/django/core/servers/basehttp.py",
line 272, in run
self.result = application(self.environ, self.start_response)

  File
"/usr/lib/python2.3/site-packages/Django-0.91-py2.3.egg/django/core/servers/basehttp.py",
line 615, in __call__
return self.application(environ, start_response)

  File
"/usr/lib/python2.3/site-packages/Django-0.91-py2.3.egg/django/core/handlers/wsgi.py",
line 155, in __call__
response = self.get_response(request.path, request)

  File
"/usr/lib/python2.3/site-packages/Django-0.91-py2.3.egg/django/core/handlers/base.py",
line 109, in get_response
return self.get_technical_error_response(request)

  File
"/usr/lib/python2.3/site-packages/Django-0.91-py2.3.egg/django/core/handlers/base.py",
line 139, in get_technical_error_response
return debug.technical_500_response(request, *sys.exc_info())

  File
"/usr/lib/python2.3/site-packages/Django-0.91-py2.3.egg/django/views/debug.py",
line 126, in technical_500_response
return HttpResponseServerError(t.render(c), mimetype='text/html')

  File
"/usr/lib/python2.3/site-packages/Django-0.91-py2.3.egg/django/core/template/__init__.py",
line 146, in render
return self.nodelist.render(context)

  File
"/usr/lib/python2.3/site-packages/Django-0.91-py2.3.egg/django/core/template/__init__.py",
line 707, in render
bits.append(self.render_node(node, context))

  File
"/usr/lib/python2.3/site-packages/Django-0.91-py2.3.egg/django/core/template/__init__.py",
line 725, in render_node
result = node.render(context)

  File
"/usr/lib/python2.3/site-packages/Django-0.91-py2.3.egg/django/core/template/defaulttags.py",
line 112, in render
nodelist.append(node.render(context))

  File
"/usr/lib/python2.3/site-packages/Django-0.91-py2.3.egg/django/core/template/defaulttags.py",
line 179, in render
return self.nodelist_true.render(context)

  File
"/usr/lib/python2.3/site-packages/Django-0.91-py2.3.egg/django/core/template/__init__.py",
line 707, in render
bits.append(self.render_node(node, context))

  File
"/usr/lib/python2.3/site-packages/Django-0.91-py2.3.egg/django/core/template/__init__.py",
line 735, in render_node
raise wrapped

TemplateSyntaxError: Caught an exception while rendering.


--~--~-~--~~~---~--~~
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: thoughts about adding a user rating

2006-03-03 Thread Glenn Tenney

On Fri, Mar 03, 2006 at 04:50:37PM -0600, James Bennett wrote:
> If it were an up-or-down, the ratings fields probably wouldn't be
> PositiveSmallintegerFields, and the comments module's
> get_rating_options method probably wouldn't use a 1-10 rating scale as
> the example in its docstring ;)

:-)

Ahhh...   I see...   For some reason, the first comments/ file I looked
at happened to be karma.py which has only an up/down rating.

THEN I saw the other ratings...   which I've been looking at between
my previous message and your message.

Thanks


> Documentation of the comment app was another thing that was supposed
> to happen a while back, and would be another great
> LittleEasyImprovement... I'm making a list.

Please Please Please do... some doc on comments would be VERY helpful
-- some example templates (complete set of templates) would be nice
too!  I haven't yet seen how to integrate / use those ratings, but I
do see those fields.


On comments...   

I find that having free_comments and "just" comments quite confusing.
I'd like to just have comments that can be either entered by a logged
in user or, if my view allows it, by any anonymous user... at least,
it SEEMS that's the difference between the free and "regular" comments.


-- 
Glenn

--~--~-~--~~~---~--~~
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: thoughts about adding a user rating

2006-03-03 Thread James Bennett

On 3/3/06, Glenn Tenney <[EMAIL PROTECTED]> wrote:
> Thanks, but it seems to me that it does a user voting (one up, or one
> down) rather than "I give this a 3 star rating".  This voting scheme
> generates an int value that can easily be ordered_by, but I don't think
> it's a user-friendly as, e.g., a five star rating.

If it were an up-or-down, the ratings fields probably wouldn't be
PositiveSmallintegerFields, and the comments module's
get_rating_options method probably wouldn't use a 1-10 rating scale as
the example in its docstring ;)

Documentation of the comment app was another thing that was supposed
to happen a while back, and would be another great
LittleEasyImprovement... I'm making a list.

--
"May the forces of evil become confused on the way to your house."
  -- George Carlin

--~--~-~--~~~---~--~~
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 in Boo

2006-03-03 Thread wizeman

Hi. I'm just starting to use Django and I'm loving it.

Don't you think it would be great if Django was ported to Boo (
http://boo.codehaus.org/ ) ?

If you don't know Boo, here are some of the main features:

- Python-like syntax
- Power of static typing with the ease-of-use of type inference
- It's compiled, so type mismatches are caught right after changing
something
- It runs on the Mono runtime (CLR), which is faster than the Python
implementation
- Extendable through macros
- It can use any .NET/Mono libraries
- Etc

I think one of the big advantages is the static typing feature. It's
great, because if you change a variable or method name (or type) in one
of your classes, and forget to change the method calls in other
classes, the error(s) would be caught at compile-time instead of
run-time.

What do you think about this?
It would be a great undertaking, but it would be awesome :)


--~--~-~--~~~---~--~~
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: view on site

2006-03-03 Thread mary

Thanks a lot Konstantin 
:) it works


--~--~-~--~~~---~--~~
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: thoughts about adding a user rating

2006-03-03 Thread Glenn Tenney

On Fri, Mar 03, 2006 at 03:02:32PM -0600, James Bennett wrote:
> Take a look at the comments app distributed with Django
> (django.contrib.comments), which has a rating system built in to it.

Thanks, but it seems to me that it does a user voting (one up, or one
down) rather than "I give this a 3 star rating".  This voting scheme
generates an int value that can easily be ordered_by, but I don't think
it's a user-friendly as, e.g., a five star rating.

I'm looking for a scheme by which each user can rate each thing on,
e.g., a scale of 1-5 stars and then be able to say "show me the top
ten user rated things", and when displaying each thing to show the
current average number of stars for that thing.

-- 
Glenn

--~--~-~--~~~---~--~~
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: thoughts about adding a user rating

2006-03-03 Thread James Bennett

On 3/3/06, Glenn Tenney <[EMAIL PROTECTED]> wrote:
> Or, ideas/thoughts/comments gladly accepted on how to structure the
> models and views-code for this.

Take a look at the comments app distributed with Django
(django.contrib.comments), which has a rating system built in to it.


--
"May the forces of evil become confused on the way to your house."
  -- George Carlin

--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



thoughts about adding a user rating

2006-03-03 Thread Glenn Tenney

A site I'm developing could greatly benefit by having a user rating
added to it... e.g. a 1-5 star rating for each post and then being
able to display the top ten posts (perhaps additionally such as top
ten added this week, or top ten on subject X, etc.) or other such
"user scoring" uses.

Before I go off trying to do this (while I'm still learning Django), I
thought that this must be a fairly common thing to have done and, not
wanting to reinvent the wheel, I wonder if anyone could point me to an
existing example code for this.

Or, ideas/thoughts/comments gladly accepted on how to structure the
models and views-code for this.

Thanks

-- 
Glenn Tenney

--~--~-~--~~~---~--~~
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: admin > site

2006-03-03 Thread James Bennett

On 3/3/06, Rob Slotboom <[EMAIL PROTECTED]> wrote:
> Can someone please tell me what can be done with the site feature in
> admin?

/me thinks maybe documenting the sites app should go into
LittleEasyImprovements on the wiki...


--
"May the forces of evil become confused on the way to your house."
  -- George Carlin

--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



ManyToMany relations and order_with_respect_to

2006-03-03 Thread akaihola

In my model I have Papers and Persons. One Paper usually has multiple
Persons as authors, and they have to be in a determined order. Every
Person can of course be author for multiple Papers.

On top of all, I'd like to be able to edit authors inline and
re-arrange their order for every Paper in admin.

Is this possible in Django (either trunk or magic-removal)?


--~--~-~--~~~---~--~~
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: Ordering with respect to a function in models?

2006-03-03 Thread akaihola

You're not alone. I need this too and couldn't find a solution.


--~--~-~--~~~---~--~~
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 > site

2006-03-03 Thread akaihola

At least the FlatPages app in Django's contrib uses the site feature.


--~--~-~--~~~---~--~~
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: Help with a custom tag

2006-03-03 Thread akaihola

First of all, do you need a template tag for this? Can't you say
{% for item in mylist %}
  {{item|slice:"0"}} = {{item|slice:"1"}}
{% endfor %}

If you want to create a for-loop-like template tag, you need some
additional machinery. It's best to use class ForNode and def do_for()
from defaulttags.py as a model.


--~--~-~--~~~---~--~~
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: Dreamhost - agh!

2006-03-03 Thread Graham King



pbx wrote:
> Adrian said:
>> I've never used Dreamhost, but I'll just toss in my two cents that
>> having a dedicated server, with root access, is well worth it.
>> ... it's still kinda-sorta affordable in the grand scheme
>> of things if you're serious about making Web apps.
> 
> I totally agree. It's great to have root. If a dedicated server is too
> spendy there's also the virtual private server (VPS) option -- I've
> used Johncompanies.com's FreeBSD VPS service for the past two years,
> and it's been great. They offer modest discounts for open source
> developers, too.
> 
> pb
> 

  I totally agree too ! The freedom of your own server (VPS) is well 
worth it. I've used linode.com for over a year now and I love it. You 
end up getting better at system administration skills (setting MySQL, 
Apache, etc) and get a much better understanding of how everything fits 
together.

  Graham.


--~--~-~--~~~---~--~~
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: Dreamhost - agh!

2006-03-03 Thread pbx

Adrian said:
> I've never used Dreamhost, but I'll just toss in my two cents that
> having a dedicated server, with root access, is well worth it.
> ... it's still kinda-sorta affordable in the grand scheme
> of things if you're serious about making Web apps.

I totally agree. It's great to have root. If a dedicated server is too
spendy there's also the virtual private server (VPS) option -- I've
used Johncompanies.com's FreeBSD VPS service for the past two years,
and it's been great. They offer modest discounts for open source
developers, too.

pb


--~--~-~--~~~---~--~~
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: Overiding the Default Flatpage template

2006-03-03 Thread David Reynolds


On 3 Mar 2006, at 10:02 am, [EMAIL PROTECTED] wrote:

>
> Hi All,
>
> The docs mentioned that you can override the default template for a
> paticular flat page.  I need to do this but do not know how ( though
> I'm trying to figure it out)
>
> Grateful for any assistance.

When you add the page you can set the template at the bottom of the  
page under the advanced options.

Hope that helps

David




--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



Overiding the Default Flatpage template

2006-03-03 Thread [EMAIL PROTECTED]

Hi All,

The docs mentioned that you can override the default template for a
paticular flat page.  I need to do this but do not know how ( though
I'm trying to figure it out)

Grateful for any assistance.


Sincerely


--~--~-~--~~~---~--~~
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: caching questions

2006-03-03 Thread tonemcd

Have you seen this Fredrik?

http://djangoutils.python-hosting.com/wiki/Utils


--~--~-~--~~~---~--~~
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: Creating a menu structure

2006-03-03 Thread mazurin

I'm going to try to do the same thing as well. I have a vague idea that
I have to write a custom view for it, but I'm still trying to figure
out the right way to do it. Any pointers?


--~--~-~--~~~---~--~~
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 > site

2006-03-03 Thread Rob Slotboom

Hi guys,

Can someone please tell me what can be done with the site feature in
admin?
And now I'm on it: from the ducumentation I understand that it is
possible to use admin interface parts in your own apps by calling
classes. Am I correct?


--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---