Re: Paginator question

2006-11-09 Thread Pythoni

Thank you for your reply
Where can I download the patch?
I still use 0.91 Django version


--~--~-~--~~~---~--~~
 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: Problem with ordering (ORDER_BY)

2006-11-09 Thread Pythoni

Jacob,
Thank you for your help. I used the comma and now it works .

La.


--~--~-~--~~~---~--~~
 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: User/request.user confusion

2006-11-09 Thread James Bennett

On 11/9/06, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote:
> I'm sure I've seen a discussion on this recently, but I can't find it
> now... I've got users that are coming to the site and it's seeing them
> as already logged in... as other users. One person even had the site
> think they were me and given admin privileges.

First question that pops into my head is to ask what sort of caching
you're doing; if, for example, you have a page template which says
"Hello, John" when John is logged in, and you're caching the rendered
template, then *every* user will see "Hello, John" until the cached
copy expires. That doesn't mean the system thinks they *are* John,
just that the HTML you've told it to cache and display contains the
string "Hello, John".

-- 
"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?hl=en
-~--~~~~--~~--~--~---



Re: Problem with ordering (ORDER_BY)

2006-11-09 Thread Jacob Kaplan-Moss

On 11/8/06 1:59 AM, Pythoni wrote:
> words.get_list(order_by=('Word'))

In Python, a single element tuple looks like ``("Word",)`` -- note the 
trailing comma.  Without it, you're doing this::

words.get_list(order_by="Word"))

And since strings are iterable, Django thinks you want to order by ``W``, then 
``o``, then...

So either use the trailing comma, or just use a list::

words.get_list(order_by=["Word"])

More here:

http://docs.python.org/tut/node7.html#SECTION00730

Jacob

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



unable to use Custom Manager

2006-11-09 Thread Picio

Hello, my code is here:
http://paste.e-scribe.com/hold/2728/

Can anyone help me find the reason whay I can't make It work?
In particular no matter if I set a filter in the custom manager
'SoloCurrentUser'
It still show me all the rows in the Admin !
I've really tried everything and the python manage.py shell retrieve
well ther rows.

Is there any "fall back" manager that override my behaviour?
How can I find a way to "destroy it"?

Please note that all the relations from the model operazione are
many-to-one, there are no Many to Many rel. in my model.

Thanks a lot for your patience about all this posts I made.
Picio

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



two sites getting mixed up

2006-11-09 Thread Kenneth Gonsalves

hi
i have two sites running under apache-modpython:

foo.com/web/
bar.foo.com/web/

both live in separate svn repositories, but share a common history in  
the sense that i exported from the first to create the second. As far  
as i can see, i have removed all references to the first from the  
second. Both sites have separate dns records in the nameserver. I am  
superuser for both sites under the name 'lawgon'. At times, when i  
log into admin on the second site, i am confronted with a list which  
comprises all the tables in the second site, along with all the  
tables of the first site. If i edit any table of the second site in  
this list, on return to home, only the second site's tables appear  
and all is normal after that. If i try to do anything with any table  
of the first site when it appears in the list of the second site i  
get 'table does not exist error'. As far as the other users of the  
second/first site are concerned, they have no problem at all. Any  
clues as to why this happens?
-- 

regards
kg
http://lawgon.livejournal.com
http://nrcfosshelpline.in/web/



--~--~-~--~~~---~--~~
 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: model question

2006-11-09 Thread yun

In the view you would need to check if the voter has already voted in
the poll. If the query is empty, then you can allow the person to vote,
if the query contains a record for a particular poll and a particular
voter, then you need to redirect them to an "You've already voted on
this poll" page.


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



tabindex HTML attribute: any way to assign to form fields in Generic Views?

2006-11-09 Thread Twitchmedia

Greetings!

Does anyone know if it's possible to assign tabindex values to forms in
a Generic View within the template?  Since the INPUT fields are
automatically generated, I'm not sure this is possible without using
Javascript to set the tabindex after the forms have been created.

Have I answered my own question?  ;)

Cheers!

Jeff


--~--~-~--~~~---~--~~
 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: Hand Count: How many Django users are there in Denver?

2006-11-09 Thread ogghead

I know there are several Django enthusiasts to your north in Boulder
and Longmont--we hosted a sprint last Saturday to try to finish Oracle
support for Django's database layer (almost there!).  Undoubtedly there
are also Django folks in Denver proper.  There are many pythoneers up
and down the Front Range...although getting more than a handful to come
to a user group meeting can be a chore.

At least two Colorado newspapers--the Boulder Daily Camera and the
Steamboat (Springs) Pilot--are Django sites, just FYI.  I work at a
pharma company where we're trying to use Django for internal web
development (hence our interest in Oracle support).

Come to the next Front Range Pythoneers meeting--we'd love to swap
Django lore:
http://wiki.python.org/moin/FrontRangePythoneers


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



Hand Count: How many Django users are there in Denver?

2006-11-09 Thread Joe Murphy

I just moved here, and am curious what the local Django scene's like.


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



override list_fiilter behaviour

2006-11-09 Thread Picio

Hello,
Is Ita possible to override the list_filter behaviour?
Where It resides?
Pico

--~--~-~--~~~---~--~~
 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: Re: Models as a Package

2006-11-09 Thread James Bennett

On 11/9/06, Nathan Yergler <[EMAIL PROTECTED]> wrote:
>class Meta:
>   app_label = 'app_name'

Yeah, that's a huge wart that comes out of the way the metasystem
works right now. Anybody got ideas for something better?

-- 
"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?hl=en
-~--~~~~--~~--~--~---



Re: Models as a Package

2006-11-09 Thread Nathan Yergler

Nevermind, I figured it out... I was forgetting the annoying

class MyModel(models.Model):

   ...

   class Meta:
  app_label = 'app_name'

Sigh...

On Thu, 2006-11-09 at 15:57 -0500, Nathan Yergler wrote:
> Any reason that making models.py into a package seems to make the models
> invisible to syncdb?
> 
> For example, with a project foo, I have a directory "models" that
> contains "bar.py" and "__init__.py"  __init__ contains "from bar import
> *", but syncdb doesn't seem to see the models.
> 
> Thoughts?
> 
> Nathan
> 
> 
> 
> > 


--~--~-~--~~~---~--~~
 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: Model validation errors ...

2006-11-09 Thread ZebZiggle

Ah ... of course.

Thanks James!

Keep up the great work!

-Sandy


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



Models as a Package

2006-11-09 Thread Nathan Yergler

Any reason that making models.py into a package seems to make the models
invisible to syncdb?

For example, with a project foo, I have a directory "models" that
contains "bar.py" and "__init__.py"  __init__ contains "from bar import
*", but syncdb doesn't seem to see the models.

Thoughts?

Nathan



--~--~-~--~~~---~--~~
 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: Admin issues

2006-11-09 Thread Picio

> Do I Have to use a custom manipulator?
>
> Thanks in advance.
> Picio
>

Sorry I want to say CUSTOM MANAGER
:(
Picio

--~--~-~--~~~---~--~~
 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: Paginator question

2006-11-09 Thread SmileyChris



On Nov 10, 2:59 am, "Pythoni" <[EMAIL PROTECTED]> wrote:
> As far as  I know paginator works with a list that is created from an
> object with
> get_count() and get_list() methods.
> If I already have a list, is it possible to use paginator with that
> list somehow too?
>
> Thank you for replies
> La.

A paginator patch was checked in a couple of days ago which makes
paginator work with a list.
So if you're using the SVN trunk, then you win :)


--~--~-~--~~~---~--~~
 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: Re: Model validation errors ...

2006-11-09 Thread James Bennett

On 11/9/06, ZebZiggle <[EMAIL PROTECTED]> wrote:
> My question is ... why is Accusation any different tan Message,
> ReadMessage or any of the other tables that relate back to Player?

The problem was that Accusation has *two* fields which relate to
Player. When 'related_name' isn't set, that means that you end up with
two things trying to have an attribute of the same name. Setting
'related_name' clears that up.

-- 
"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?hl=en
-~--~~~~--~~--~--~---



Re: Model validation errors ...

2006-11-09 Thread ZebZiggle

More on this:

If I change Accusation to:

class Accusation(models.Model):
game = models.ForeignKey(Game)
player = models.ForeignKey(Player, related_name='related_player')
accusedPlayer = models.ForeignKey(Player,
related_name='related_accusedPlayer')
isCommitted = models.BooleanField()
motive = models.CharField(maxlength = 1024)
method = models.CharField(maxlength = 1024)

then it validates and installs (and the session tables, etc get
installed too)

My question is ... why is Accusation any different tan Message,
ReadMessage or any of the other tables that relate back to Player?

Cheers,
Sandy


--~--~-~--~~~---~--~~
 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: Apache 2.0.58 will not OBEY on OS X 10.4.8

2006-11-09 Thread sorrison

Hi again,

Firstly i would turn PythonDebug On,

Here is a sample of what i use in a production enviroment
maybe this might help.

Cheers,

Sam


SetHandler mod_python
PythonHandler django.core.handlers.modpython
PythonPath "['/path/to/python/code'] + sys.path"
SetEnv DJANGO_SETTINGS_MODULE mysite.settings
PythonInterpreter mysite
PythonDebug Off


Alias /site_media "/path/to/templates"

SetHandler None
AllowOverride All



Options None
AllowOverride None
Order deny,allow
Allow from all



SetHandler None



Options +FollowSymLinks
AllowOverride None
Order deny,allow
Allow from all


Alias /media "/path/to/admin/media"


SetHandler None


On Nov 10, 8:13 am, "kmr" <[EMAIL PROTECTED]> wrote:
> I've changed the httpd.conf to read:
>
> 
> DocumentRoot /Users/kimvandenbroek/Sites/mysite
>
> 
> SetHandler mod_python
> PythonHandler django.core.handlers.modpython
> PythonPath sys.path+['/Users/kimvandenbroek/Sites']
> SetEnv DJANGO_SETTINGS_MODULE mysite.settings
> 
> 
>
> This coincides with the location of my python code and settings.py file
> at:
>
> /Users/kimvandenbroek/Sites/mysite/settings.py
>
> With the change, the apache error_log shows:
>
> [Thu Nov 09 10:56:57 2006] [notice] mod_python: Creating 32 session
> mutexes based on 3 max processes and 25 max threads.
> [Thu Nov 09 10:56:57 2006] [notice] Apache/2.0.58 (Unix)
> mod_python/3.1.4 Python/2.4.1 configured -- resuming normal operations
>
> The mysite directory contains:
> __init__.py
> __init__.pyc
> manage.py
> settings.py
> settings.pyc
> urls.py
> urls.pyc
> polls (directory for polls tutorial)
> 
> Thanks,
> 
> kmr


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



Model validation errors ...

2006-11-09 Thread ZebZiggle

Hi there,

I've decided to drop my old 0.91 database and rebuild, rather than try
to upgrade it. So, in my dev environment I've dropped the database, but
now when I try to 'syncdb' I get the following validation error.

Error: Couldn't install apps, because there were errors in one or more
models:
mydarksecret.accusation: Accessor for field 'player' clashes with
related field 'Player.accusation_set'. Add a related_name argument
 to the definition for 'player'.
mydarksecret.accusation: Accessor for field 'accusedPlayer' clashes
with related field 'Player.accusation_set'. Add a related_name a
rgument to the definition for 'accusedPlayer'.

This strikes me as wierd since there are many other tables that have
similar relationships, but it only seems to complain about
'accusation'. See some sample tables below.

Also, I can't seem to get the "django infrastructure" created. syncdb
doesn't want to create them ... is there another manage.py command I
should be using to get things like the session table created?

Any ideas?

Thx,
Sandy

 (partial) MODEL 

class Player(models.Model):
user = models.ForeignKey(User, null = True)
game = models.ForeignKey(Game)
character = models.ForeignKey(GameElement)
joinedOn = models.DateTimeField(auto_now_add = True)

class Message(models.Model):
gameElement = models.ForeignKey(GameElement)
player = models.ForeignKey(Player)
emotion = models.IntegerField()
dateTime = models.DateTimeField(auto_now_add = True)
subject = models.CharField(maxlength = 100)
text = models.CharField(maxlength = 1024)

class ReadMessage(models.Model):
gameElement = models.ForeignKey(GameElement)
player = models.ForeignKey(Player)
dateTime = models.DateTimeField(auto_now_add = True)

class Accusation(models.Model):
game = models.ForeignKey(Game)
player = models.ForeignKey(Player)
accusedPlayer = models.ForeignKey(Player)
isCommitted = models.BooleanField()


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



Workflow engine for python?

2006-11-09 Thread mamcxyz

Exist a workflow engine for python as http://wf.netfx3.com/?

I don't need a User GUI because is for plug it into a web service I'm
working on django.

The workflow is pretty simple and work similare to:

Start
-- Get File
   -- Run Process1
   In parallel:
   - Run Task1
   - Run Task2
   If Fail
   - SendMail
   -- Run Process2
   -- Save To FTP
Done

Alwasy can be described as a tree.


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



Paginator question

2006-11-09 Thread Pythoni

As far as  I know paginator works with a list that is created from an
object with
get_count() and get_list() methods.
If I already have a list, is it possible to use paginator with that
list somehow too?

Thank you for replies
La.


--~--~-~--~~~---~--~~
 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: Apache 2.0.58 will not OBEY on OS X 10.4.8

2006-11-09 Thread kmr

I've changed the httpd.conf to read:


DocumentRoot /Users/kimvandenbroek/Sites/mysite


SetHandler mod_python
PythonHandler django.core.handlers.modpython
PythonPath sys.path+['/Users/kimvandenbroek/Sites']
SetEnv DJANGO_SETTINGS_MODULE mysite.settings



This coincides with the location of my python code and settings.py file
at:

/Users/kimvandenbroek/Sites/mysite/settings.py

With the change, the apache error_log shows:

[Thu Nov 09 10:56:57 2006] [notice] mod_python: Creating 32 session
mutexes based on 3 max processes and 25 max threads.
[Thu Nov 09 10:56:57 2006] [notice] Apache/2.0.58 (Unix)
mod_python/3.1.4 Python/2.4.1 configured -- resuming normal operations

The mysite directory contains:
__init__.py
__init__.pyc
manage.py
settings.py
settings.pyc
urls.py
urls.pyc
polls (directory for polls tutorial)

Thanks,

kmr


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



Admin issues

2006-11-09 Thread Picio

Hello, I have this model:

class operazione(models.Model):
descrizione = models.TextField()
data = models.DateField('giorno')
ore_uomo = models.FloatField(max_digits=2, decimal_places=1)
progetto = models.ForeignKey(progetto)
tipologia = models.ForeignKey(tipologia)
myuser = models.ForeignKey(User,related_name="myuser",
blank=True,editable=False)

def __str__(self):
  return str(self.data)

class Meta:
  verbose_name_plural = "Operazioni"

class Admin:
   date_hierarchy ='data'
   list_display = 
('progetto','descrizione','ore_uomo','tipologia','myuser',)
   search_fields = ('descrizione',)
   list_filter = ('data','progetto','myuser',)

As you see in the last row I have a filtering widget also for myuser
that is the current user logged in. (I used the threading trick from
the django wiki so I have a get_current_user() defined in my model
callable from everywhere). I want to  filter directly the rows (in
other words not manually). I need to show only current user's rows.

How can I filter (by "myuser" field) rows inside the page that shows
all "Operazioni" records?
Do I Have to use a custom manipulator?

Thanks in advance.
Picio

--~--~-~--~~~---~--~~
 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: model question

2006-11-09 Thread Rob Slotboom

Rob Hudson schreef:

> I'd kind of think that in Vote you don't need the poll FK, just the
> choice since the choice then maps to a particular poll.

But how do I prevent a voter to vote more than once on a poll?


--~--~-~--~~~---~--~~
 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: model question

2006-11-09 Thread Rob Hudson

I'd kind of think that in Vote you don't need the poll FK, just the
choice since the choice then maps to a particular poll.  Though the
Django admin won't do inline editing of FK relationships more than 2
deep.

Otherwise I think the effect your seeing makes sense.  There is nothing
in these models which say that Vote should only relate to the Choices
of that particular Poll.


--~--~-~--~~~---~--~~
 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, RDF & XUL

2006-11-09 Thread orestis

Hey, can you give some more info on the stack of this application ?

Is it client-server, standalone ? What advantages does it have over the
normal HTML approach ?


--~--~-~--~~~---~--~~
 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: how are you handling i18n and m10l content?

2006-11-09 Thread coulix

i like this ! :) very pythonic.


--~--~-~--~~~---~--~~
 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, RDF & XUL

2006-11-09 Thread Perica Zivkovic

whoa this sounds really as a cool idea



On 11/9/06, David Larlet <[EMAIL PROTECTED]> wrote:
>
> 2006/11/9, James Bennett <[EMAIL PROTECTED]>:
> >
> > On 11/8/06, benj <[EMAIL PROTECTED]> wrote:
> > > Does anyone have experience translating django models into RDF graphs?
> > > My ideal views would look something like this:
> >
> > Off the top of my head I don't know of anyone who's done this, but it
> > would certainly be a useful thing to have available. Maybe we could
> > work on developing an RDF serializer to go into Django's serialization
> > framework..
>
> +1 very interesting project!
>
> >
>

--~--~-~--~~~---~--~~
 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: how are you handling i18n and m10l content?

2006-11-09 Thread Aidas Bendoraitis

Only after implementation :) Keep in mind, that not only the database
API of Django has to be modified, but also the administration
interface, if we stuck at this solution.

By the way, I forgot to set language in the WHERE clause of my
example, but that makes no big difference for imagining what I had in
mind:
SELECT * FROM myapp_mymodel mm INNER JOIN myapp_mymodel_translatable mmt ON
mm.id = mmt.id WHERE mmt.language = 'EN' ORDER BY title

And also perhaps we need a separate branch for implementation of
multilingual modelling.

Regards,
Aidas Bendoraitis [aka Archatas]



On 11/9/06, Carlos Yoder <[EMAIL PROTECTED]> wrote:
>
> > David Bleweet said:
> >> Actually this could be integrated into the core.
> >> When you create a model, you could add translatable=True to fields
> >> that have to be in the language-specific table.
> >> When you make selections, you would need to set the language name in
> >> the following or a similar way:
> >> MyModel.objects.by_language("EN").all()
> >> MyModel.objects.by_language("EN").order_by('title')
> >> which would form queries like:
> >> SELECT * FROM myapp_mymodel INNER JOIN myapp_mymodel_translatable ON
> >> myapp_mymodel.id = myapp_mymodel_translatable.id ORDER BY title
> >
> > What about using generic relations for this? You could have something
> > like this:
> >
> > class I18NText(models.Model):
> > language = models.ForeignKey(Language)
> > field = models.CharField(maxlength=25)
> > translated_text = models.TextField()
> >
> > content_type = models.ForeignKey(ContentType)
> > object_id = models.PositiveIntegerField()
> > translated_object = models.GenericForeignKey()
> >
> > def __str__(self):
> > return self.translated_text
> >
> > class ModelNeedingTranslation(models.Model):
> > foo = models.IntegerField()
> > bar = models.TextField()
> >
> > translations = models.GenericRelation(I18NText)
> >
> > Then you can add translations of field(s) by doing:
> > a = ModelNeedingTranslation(1, 'nothing')
> > a.translations.create(field='bar', translated_text='nada',
> > language=Language('Spanish'))
> >
> > You can get the text for a specific translation like this:
> > a.translations.filter(field='bar', language=Language('Spanish'))
>
> :-O
>
> Would it be really that simple?
>
> --
> Carlos Yoder
> http://blog.argentinaslovenia.com/
>
> >
>

--~--~-~--~~~---~--~~
 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: how are you handling i18n and m10l content?

2006-11-09 Thread Carlos Yoder

> David Bleweet said:
>> Actually this could be integrated into the core.
>> When you create a model, you could add translatable=True to fields
>> that have to be in the language-specific table.
>> When you make selections, you would need to set the language name in
>> the following or a similar way:
>> MyModel.objects.by_language("EN").all()
>> MyModel.objects.by_language("EN").order_by('title')
>> which would form queries like:
>> SELECT * FROM myapp_mymodel INNER JOIN myapp_mymodel_translatable ON
>> myapp_mymodel.id = myapp_mymodel_translatable.id ORDER BY title
>
> What about using generic relations for this? You could have something
> like this:
>
> class I18NText(models.Model):
> language = models.ForeignKey(Language)
> field = models.CharField(maxlength=25)
> translated_text = models.TextField()
>
> content_type = models.ForeignKey(ContentType)
> object_id = models.PositiveIntegerField()
> translated_object = models.GenericForeignKey()
>
> def __str__(self):
> return self.translated_text
>
> class ModelNeedingTranslation(models.Model):
> foo = models.IntegerField()
> bar = models.TextField()
>
> translations = models.GenericRelation(I18NText)
>
> Then you can add translations of field(s) by doing:
> a = ModelNeedingTranslation(1, 'nothing')
> a.translations.create(field='bar', translated_text='nada',
> language=Language('Spanish'))
>
> You can get the text for a specific translation like this:
> a.translations.filter(field='bar', language=Language('Spanish'))

:-O

Would it be really that simple?

-- 
Carlos Yoder
http://blog.argentinaslovenia.com/

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



Paginator question

2006-11-09 Thread Pythoni

As far as  I know paginator works with a list that is created from an
object with
get_count() and get_list() methods.
If I already have a list, is it possible to use paginator with that
list somehow too?

Thank you for replies
La.


--~--~-~--~~~---~--~~
 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: Re: edit_inline behavior

2006-11-09 Thread Phil Davis

On 11/9/06, Russell Keith-Magee <[EMAIL PROTECTED]> wrote:
>
> On 11/9/06, Phil Davis <[EMAIL PROTECTED]> wrote:
[...]
> > I have just tried a 'by-the-docs' generic view with simple 2 model
> > master/detail update form and get exactly the same problem or
> > duplicated detail rows after each save.
>
> This result is common if you omit the  that
> is part of each row of the edit_inline table. The hidden input
> argument is requried, as it ties the row of the edit_inline table to
> the existing element.
>
> Check your template to make sure it contains all the required input
> elements (including the hidden ones) - if you are looking for a
> comparison, look at the generated HTML for the admin pages.

Yep, that was it.

In my defense I had eventually tried adding the hidden fields (detail
model 'id' field) and I thought I had restarted apache but obviously
did not.

NB I looked very hard for a complete generic views CRUD example which
uses master/detail models but could not find anything. Does anyone
have a good link?

Cheers,

-- 
Phil Davis

--~--~-~--~~~---~--~~
 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: Child Category Views

2006-11-09 Thread Jamie Pittock

Sorry, I missed those last two replies as I was replying myself.  I'll
take a look now and check I'm doing things right.

Many 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?hl=en
-~--~~~~--~~--~--~---



Re: Child Category Views

2006-11-09 Thread Jamie Pittock

great.  I'm sure it's not perfect yet but I ended up with this:

def entries_by_category(request, slug, childslug=None):

if childslug is not None: slug = childslug
category = get_object_or_404(Category, slug=slug)
entry_list_by_category = category.entry_set.order_by('-pub_date',
'title')
return render_to_response('cake/entries_by_category.html',
{'entry_list_by_category': entry_list_by_category, 'category':
category})


--~--~-~--~~~---~--~~
 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: Re: Child Category Views

2006-11-09 Thread Russell Keith-Magee

On 11/9/06, Jamie Pittock <[EMAIL PROTECTED]> wrote:
>
> I'm sure there must be a way of doing this with just the one view
> though.

There are multiple ways, depending on the exact result you want.

One way is to define a view with a default argument:

def entries_by_category(request, slug, childslug=None):
if childslug:
category = get_object_or_404(Category, slug=childslug)
else:
category = get_object_or_404(Category, slug=slug)
... rest of method as previous

This way, if you don't provide a childslug (as with the URLPattern
that only has one argument), the childslug will assume the default.

Another way that would work for your specific example would be to
simplify by just redefining your urlpatterns:

   (r'^category/[-\w]+/(?P[-\w]+)',
'entries_by_category'),
   (r'^category/(?P[-\w]+)', 'entries_by_category'),

This is only possible because your entries_by_child_category method
doesn't actually use childslug _AND_ slug. This urlpattern throws away
the parent slug, and can therefore use the same method definition for
both patterns.

Hope this helps,

Yours,
Russ Magee %-)

--~--~-~--~~~---~--~~
 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: Child Category Views

2006-11-09 Thread ToddG

I think you can just use:

def entries_by_category(request, slug, childslug=None)

with your first urlpattern and then switch on childslug, i.e. if it's
set or not.

Also you're prob already looking at this but

http://www.djangoproject.com/documentation/url_dispatch/#named-groups

should help if you missed 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?hl=en
-~--~~~~--~~--~--~---



Re: Child Category Views

2006-11-09 Thread Jeremy Dunck

On 11/9/06, Jamie Pittock <[EMAIL PROTECTED]> wrote:
> (r'^category/(?P[-\w]+)/(?P[-\w]+)', 
> 'entries_by_child_category'),


How about:

(r'^category/(?P[-\w]+)(/(?P[-\w]+))?/$',
'entries_by_category'),

def entries_by_category(request, slug, childslug=None):
...

?

--~--~-~--~~~---~--~~
 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: Re: edit_inline behavior

2006-11-09 Thread Russell Keith-Magee

On 11/9/06, Phil Davis <[EMAIL PROTECTED]> wrote:
>
> On 8/13/06, John <[EMAIL PROTECTED]> wrote:
> > edit_inline seems to be doing something funky when I use it through
> > update_object generic view.  I've got a model that looks something like
> > this:
> [...]
> > At first glance it appears to be working -- the update_oject view for
> > StationEvent lists its fields and a field for a participant.  But when
> > it's actually saved, what happens is that for each participant listed,
> > it will create a new StationEventParticipant object whether or not it
> > already existed.  So every time I come back after saving the list of
> > participants doubles!
>
> Did you ever find out the answer to this problem?
>
> I have just tried a 'by-the-docs' generic view with simple 2 model
> master/detail update form and get exactly the same problem or
> duplicated detail rows after each save.

This result is common if you omit the  that
is part of each row of the edit_inline table. The hidden input
argument is requried, as it ties the row of the edit_inline table to
the existing element.

Check your template to make sure it contains all the required input
elements (including the hidden ones) - if you are looking for a
comparison, look at the generated HTML for the admin pages.

Yours,
Russ Magee %-)

--~--~-~--~~~---~--~~
 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: Bug?

2006-11-09 Thread Russell Keith-Magee

On 11/9/06, Tom Smith <[EMAIL PROTECTED]> wrote:
>
> I get this on a page called, funnily enough, "amp"
>
> Is it a bug?

Well... unless a MemoryError is the expected result... yes :-)

>  return html.replace('&', '').replace('<', '').replace
> ('>', '').replace('"', '').replace("'", '')

What is the contents of html at this point? It this error happening
consistently, or only with one particular string/template? What are
you rendering to produce this error?

Yours,
Russ Magee %-)

--~--~-~--~~~---~--~~
 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: how are you handling i18n and m10l content?

2006-11-09 Thread David Blewett

On Nov 9, 4:28 am, "Aidas Bendoraitis" <[EMAIL PROTECTED]>
wrote:
> Actually this could be integrated into the core.
> When you create a model, you could add translatable=True to fields
> that have to be in the language-specific table.
> When you make selections, you would need to set the language name in
> the following or a similar way:
> MyModel.objects.by_language("EN").all()
> MyModel.objects.by_language("EN").order_by('title')
> which would form queries like:
> SELECT * FROM myapp_mymodel INNER JOIN myapp_mymodel_translatable ON
> myapp_mymodel.id = myapp_mymodel_translatable.id ORDER BY title

What about using generic relations for this? You could have something
like this:

class I18NText(models.Model):
language = models.ForeignKey(Language)
field = models.CharField(maxlength=25)
translated_text = models.TextField()

content_type = models.ForeignKey(ContentType)
object_id = models.PositiveIntegerField()
translated_object = models.GenericForeignKey()

def __str__(self):
return self.translated_text

class ModelNeedingTranslation(models.Model):
foo = models.IntegerField()
bar = models.TextField()

translations = models.GenericRelation(I18NText)

Then you can add translations of field(s) by doing:
a = ModelNeedingTranslation(1, 'nothing')
a.translations.create(field='bar', translated_text='nada',
language=Language('Spanish'))

You can get the text for a specific translation like this:
a.translations.filter(field='bar', language=Language('Spanish'))

David Blewett


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



model question

2006-11-09 Thread Rob Slotboom

I'm trying to get a very simple relationship to work but I can't figure
ou how to do this in Django.
This is what I want.

Poll ---<< question

Poll ---<< vote

A user can vote a poll just once. I check this using a function which
gets the remote ip.

This is the models.py snippet

class Poll(models.Model):
   question = models.CharField('vraag', maxlength=200)
   pub_date = models.DateTimeField('publicatie datum')

   def has_remote_addr_voted(self, ip):
  result = False
  if (self.vote_set.filter(voter_ip = ip).count() > 0):
 result = True
  return result

   class Admin:
  fields = (
 (None, {'fields': ('question','pub_date',)}),
  )
  pass

class Choice(models.Model):
   poll = models.ForeignKey(Poll, edit_inline=models.TABULAR,
num_in_admin=3)
   choice = models.CharField(maxlength=200, core=True)
   votes = models.IntegerField(core=True)

class Vote(models.Model):
   poll = models.ForeignKey(Poll, edit_inline=models.TABULAR,
num_in_admin=3)
   voter_ip = models.IPAddressField(core=True)
   choice = models.ForeignKey(Choice, edit_inline=models.TABULAR,
num_in_admin=3)

   class Meta:
  unique_together = (("poll", "voter_ip"),)

The model is correct but the problem occurs in admin.

Editing a poll you get the related choices and votes. For a vote you
can select a choice from a list which contains all choices, not the
choices for the current poll.


--~--~-~--~~~---~--~~
 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: Child Category Views

2006-11-09 Thread Jamie Pittock

Sorry to reply to myself so quickly.

After a bit of refactoring my two views look like this:

def entries_by_category(request, slug):

category = get_object_or_404(Category, slug=slug)
entry_list_by_category = category.entry_set.order_by('-pub_date',
'title')
return render_to_response('cake/entries_by_category.html',
{'entry_list_by_category': entry_list_by_category, 'category':
category})

def entries_by_child_category(request, slug, childslug):

category = get_object_or_404(Category, slug=childslug)
entry_list_by_category = category.entry_set.order_by('-pub_date',
'title')
return render_to_response('cake/entries_by_category.html',
{'entry_list_by_category': entry_list_by_category, 'category':
category})

With the urlpatterns:

(r'^category/(?P[-\w]+)/(?P[-\w]+)',
'entries_by_child_category'),
(r'^category/(?P[-\w]+)', 'entries_by_category'),

I'm sure there must be a way of doing this with just the one view
though.


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



Child Category Views

2006-11-09 Thread Jamie Pittock

Hi folks,

I've just started transporting an existing site to Django as a learning
exercise and some quick help would be appreciated.

I'm using some code from the cookbook to allow parent/child categories:

http://code.djangoproject.com/wiki/CookBookCategoryDataModelPostMagic

That's all dandy.  What I'm struggling with is the views listing
entries by category.

At the moment I have one view for the parent category and then another
if a child category is in the url.

This is the view I'm using if there's just one category.

def entries_by_category(request, slug):

category = Category.objects.get(slug=slug)
entry_list = category.entry_set.order_by('-pub_date', 'title')

t = loader.get_template('cake/entries_by_category.html')
c = Context({
'object_list': entry_list,
'category_name': category,
})

return HttpResponse(t.render(c))

And then as I say, if there's also a child category in the url I'm
basically replicating that view with

def entries_by_child_category(request, slug, childslug):

I'm sure there's a much better way of doing this using just one view.
Can anyone give me a pointer?

Jamie


--~--~-~--~~~---~--~~
 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: edit_inline behavior

2006-11-09 Thread Phil Davis

On 8/13/06, John <[EMAIL PROTECTED]> wrote:
> edit_inline seems to be doing something funky when I use it through
> update_object generic view.  I've got a model that looks something like
> this:
[...]
> At first glance it appears to be working -- the update_oject view for
> StationEvent lists its fields and a field for a participant.  But when
> it's actually saved, what happens is that for each participant listed,
> it will create a new StationEventParticipant object whether or not it
> already existed.  So every time I come back after saving the list of
> participants doubles!

Did you ever find out the answer to this problem?

I have just tried a 'by-the-docs' generic view with simple 2 model
master/detail update form and get exactly the same problem or
duplicated detail rows after each save.

-- 
Phil Davis

--~--~-~--~~~---~--~~
 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: how are you handling i18n and m10l content?

2006-11-09 Thread Kenneth Gonsalves


On 09-Nov-06, at 4:03 PM, Carlos Yoder wrote:

> And now I read what I wrote. Enough time *and* skills? That could  
> be tricky ;-)

i  have been meaning to hack on django for nearly a year and a half  
now - maybe it's time to get my feet wet ;-)

-- 

regards
kg
http://lawgon.livejournal.com
http://nrcfosshelpline.in/web/



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



Bug?

2006-11-09 Thread Tom Smith

I get this on a page called, funnily enough, "amp"

Is it a bug?


TemplateSyntaxError: Caught an exception while rendering:

Original Traceback (most recent call last):
   File "/users/home/tomsmith/domains/burningahole.co.uk/django/ 
django/template/__init__.py", line 706, in render_node
 result = node.render(context)
   File "/users/home/tomsmith/domains/burningahole.co.uk/django/ 
django/template/defaulttags.py", line 118, in render
 nodelist.append(node.render(context))
   File "/users/home/tomsmith/domains/burningahole.co.uk/django/ 
django/template/__init__.py", line 752, in render
 output = self.filter_expression.resolve(context)
   File "/users/home/tomsmith/domains/burningahole.co.uk/django/ 
django/template/__init__.py", line 561, in resolve
 obj = func(obj, *arg_vals)
   File "/users/home/tomsmith/domains/burningahole.co.uk/django/ 
django/template/defaultfilters.py", line 172, in escape
 return escape(value)
   File "/users/home/tomsmith/domains/burningahole.co.uk/django/ 
django/utils/html.py", line 28, in escape
 return html.replace('&', '').replace('<', '').replace 
('>', '').replace('"', '').replace("'", '')
MemoryError

--~--~-~--~~~---~--~~
 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: how are you handling i18n and m10l content?

2006-11-09 Thread Carlos Yoder

> > Aidas Bendoraitis wrote:
> >> MyModel.objects.by_language("EN").all()
> >> MyModel.objects.by_language("EN").order_by('title')
> >
> > I think this would be greate.
>
> sensational is the word ;-)
>

Now we just need to get one of the Django-savvy developers to
implement it, since I'm sure they don't have anything else to do :-)

Now seriously, this would be fantastic. I'm in no position to help
with code (I started one of the reference threads, asking for help),
so I can only hope and cross my fingers for some guy(s) with with
enough time and skills will bite the bullet and start coding.

And now I read what I wrote. Enough time *and* skills? That could be tricky ;-)

Cheers,

-- 
Carlos Yoder
http://blog.argentinaslovenia.com/

--~--~-~--~~~---~--~~
 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: how are you handling i18n and m10l content?

2006-11-09 Thread fdb

Kenneth Gonsalves wrote:
> i took a look at this - it seems to imply that there is only one
> translateable field in the model (I may be wrong). But for me a
> typical page model would have several Char fields and more than one
> text field. How does one handle that? I was thinking having

Actually, all the fields in the model are translatable. You just create
a language-specific version of your model. None of the fields have to
match, you just have to set the translation_of. That is the link to the
root language version.

I do use this to translate paths ("slugs") and titles as well, with
minimum fuss.


--~--~-~--~~~---~--~~
 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: how are you handling i18n and m10l content?

2006-11-09 Thread Gacha

I agree to you about my version of this, but it was the best I could
figure out :) I readed your suggestion and I think it's very good and I
think it's very easy to implement in django system.


--~--~-~--~~~---~--~~
 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: how are you handling i18n and m10l content?

2006-11-09 Thread Kenneth Gonsalves


On 09-Nov-06, at 3:03 PM, Gacha wrote:

> Aidas Bendoraitis wrote:
>> MyModel.objects.by_language("EN").all()
>> MyModel.objects.by_language("EN").order_by('title')
>
> I think this would be greate.

sensational is the word ;-)

-- 

regards
kg
http://lawgon.livejournal.com
http://nrcfosshelpline.in/web/



--~--~-~--~~~---~--~~
 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: how are you handling i18n and m10l content?

2006-11-09 Thread Aidas Bendoraitis

Gacha,
In your suggestion there is no way to sort objects by
language-specific fields, except in the programming language level, is
there? And the other disadvantage is that value field is always of the
TEXT type whereas sometime it could be VARCHAR or CHAR, so you are
kind of wasting resources.

Regards,
Aidas Bendoraitis [aka Archatas]



On 11/9/06, Gacha <[EMAIL PROTECTED]> wrote:
>
> I developed an e-shop web and I implemented unlimited language support
> for all content. Every model realy holded only integer values and
> values, that should't be translated. Fields like "title" and
> "description" was virtual, they didn't exist in the table, but I was
> able to call them like "Model.field" and get the value translated to
> current language.
>
> All the translations was stored in Trans table, with structure: (id |
> table | field | fid | lang | value ). For example you have a model like
> Category and every category has name and it should be in all languages.
> To get the name of the category you do:
>
> c = Category.objects.get(pk=1)
> print c.name
>
> In "print c.name" it will call __getattr__ function and then a helper
> function witch will return a record from Trans table WHERE
> table='category' AND field='name' AND fid=1 AND lang='EN'.
>
> I think that this can be done in "django way", maybe later someone can
> make a field like TransField and all other stuff would be automaticly.
>
> I hope you get the point, sorry for bad english :)
>
>
> >
>

--~--~-~--~~~---~--~~
 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: how are you handling i18n and m10l content?

2006-11-09 Thread Gacha


Aidas Bendoraitis wrote:
> MyModel.objects.by_language("EN").all()
> MyModel.objects.by_language("EN").order_by('title')

I think this would be greate.


--~--~-~--~~~---~--~~
 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: how are you handling i18n and m10l content?

2006-11-09 Thread Gacha

I developed an e-shop web and I implemented unlimited language support
for all content. Every model realy holded only integer values and
values, that should't be translated. Fields like "title" and
"description" was virtual, they didn't exist in the table, but I was
able to call them like "Model.field" and get the value translated to
current language.

All the translations was stored in Trans table, with structure: (id |
table | field | fid | lang | value ). For example you have a model like
Category and every category has name and it should be in all languages.
To get the name of the category you do:

c = Category.objects.get(pk=1)
print c.name

In "print c.name" it will call __getattr__ function and then a helper
function witch will return a record from Trans table WHERE
table='category' AND field='name' AND fid=1 AND lang='EN'.

I think that this can be done in "django way", maybe later someone can
make a field like TransField and all other stuff would be automaticly.

I hope you get the point, sorry for bad english :)


--~--~-~--~~~---~--~~
 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: how are you handling i18n and m10l content?

2006-11-09 Thread Aidas Bendoraitis

+1 for this type of solution.

Just there is no need for the intermediate table between the table
with untranslatable fields and the table with translatable ones,
because the relationship between these two tables is one to many. So
the table with translatable fields could just have a FK to the table
with untranslatable fields. So the solution is more or less the same
as I proposed some time ago.

Actually this could be integrated into the core.
When you create a model, you could add translatable=True to fields
that have to be in the language-specific table.
When you make selections, you would need to set the language name in
the following or a similar way:
MyModel.objects.by_language("EN").all()
MyModel.objects.by_language("EN").order_by('title')
which would form queries like:
SELECT * FROM myapp_mymodel INNER JOIN myapp_mymodel_translatable ON
myapp_mymodel.id = myapp_mymodel_translatable.id ORDER BY title

Regards,
Aidas Bendoraitis [aka Archatas]



On 11/9/06, Kenneth Gonsalves <[EMAIL PROTECTED]> wrote:
>
>
> On 08-Nov-06, at 5:22 PM, fdb wrote:
>
> > Note again that it's perfectly fine to add objects in another language
> > than the default that don't have translations in the default language.
> > One restriction: you cannot translate a page that doesn't have a
> > default language version.
>
> i took a look at this - it seems to imply that there is only one
> translateable field in the model (I may be wrong). But for me a
> typical page model would have several Char fields and more than one
> text field. How does one handle that? I was thinking having
>
> 1. languages table - longname and shortname
> 2. for each table a translate table with fk to languages table and fk
> to the translated table. This table will contain only translateable
> fields (char and text). The two fks are unique_together. Whenever the
> app sees a text or char field, it searches for a translation to insert.
> 3. Translation would be page independant and table independant. For
> any given language, the app searches for all untranslated text and
> char fields and displays them, one can select to translate.
> 4. Provision should be made for automatically translating strings,
> review of this and review of translations themselves.
>
> --
>
> regards
> kg
> http://lawgon.livejournal.com
> http://nrcfosshelpline.in/web/
>
>
>
> >
>

--~--~-~--~~~---~--~~
 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, RDF & XUL

2006-11-09 Thread David Larlet

2006/11/9, James Bennett <[EMAIL PROTECTED]>:
>
> On 11/8/06, benj <[EMAIL PROTECTED]> wrote:
> > Does anyone have experience translating django models into RDF graphs?
> > My ideal views would look something like this:
>
> Off the top of my head I don't know of anyone who's done this, but it
> would certainly be a useful thing to have available. Maybe we could
> work on developing an RDF serializer to go into Django's serialization
> framework..

+1 very interesting project!

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