[Django]扩展auth模块产生用户上下级关系

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

[Django]扩展auth模块产生用户上下级关系

Gawain Bai-2
如何把auth模块中的User扩展产生上下级关系?

我新建了 一个model是这样写的,老是报错。
from django.contrib.auth.models import User
class UserRelation(models.Model):
    User = models.ForeignKey(User)
    Superior = models.ForeignKey(User)

--
#~~~~
class khsing:
    def __init__(self):
        self.name='Gawain Bai'
        self.blog='http://blog.khsing.net'
        self.home='Jail'
#coding... ...
_______________________________________________
python-chinese
Post: send [hidden email]
Subscribe: send subscribe to [hidden email]
Unsubscribe: send unsubscribe to  [hidden email]
Detail Info: http://python.cn/mailman/listinfo/python-chinese
Reply | Threaded
Open this post in threaded view
|

Re: [Django]扩展auth模块产生用户上下级关系

@@-2
多个FK指向同一个表应该要制定一个名字吧

On Jan 13, 2008 7:18 PM, Gawain Bai <[hidden email]> wrote:
如何把auth模块中的User扩展产生上下级关系?

我新建了 一个model是这样写的,老是报错。
from django.contrib.auth.models import User
class UserRelation(models.Model):
   User = models.ForeignKey(User)
   Superior = models.ForeignKey(User)

--
#~~~~
class khsing:
   def __init__(self):
       self.name='Gawain Bai'
        self.blog='http://blog.khsing.net'
       self.home='Jail'
#coding... ...
_______________________________________________
python-chinese
Post: send [hidden email]
Subscribe: send subscribe to [hidden email]
Unsubscribe: send unsubscribe to  [hidden email]
Detail Info: http://python.cn/mailman/listinfo/python-chinese


_______________________________________________
python-chinese
Post: send [hidden email]
Subscribe: send subscribe to [hidden email]
Unsubscribe: send unsubscribe to  [hidden email]
Detail Info: http://python.cn/mailman/listinfo/python-chinese
Reply | Threaded
Open this post in threaded view
|

Re: [Django]扩展auth模块产生用户上下级关系

leopay
要指明related name

On 1/13/08, @@ <[hidden email]> wrote:
多个FK指向同一个表应该要制定一个名字吧


On Jan 13, 2008 7:18 PM, Gawain Bai <[hidden email]> wrote:
如何把auth模块中的User扩展产生上下级关系?

我新建了 一个model是这样写的,老是报错。
from django.contrib.auth.models import User
class UserRelation(models.Model):
   User = models.ForeignKey(User)
   Superior = models.ForeignKey(User)

--
#~~~~
class khsing:
   def __init__(self):
       self.name='Gawain Bai'
        self.blog='http://blog.khsing.net'
       self.home='Jail'
#coding... ...
_______________________________________________
python-chinese
Post: send [hidden email]
Subscribe: send subscribe to [hidden email]
Unsubscribe: send unsubscribe to  [hidden email]
Detail Info: <a onclick="return top.js.OpenExtLink(window,event,this)" href="http://python.cn/mailman/listinfo/python-chinese" target="_blank">http://python.cn/mailman/listinfo/python-chinese


_______________________________________________
python-chinese
Post: send [hidden email]
Subscribe: send subscribe to [hidden email]
Unsubscribe: send unsubscribe to  [hidden email]
Detail Info: <a onclick="return top.js.OpenExtLink(window,event,this)" href="http://python.cn/mailman/listinfo/python-chinese" target="_blank">http://python.cn/mailman/listinfo/python-chinese


_______________________________________________
python-chinese
Post: send [hidden email]
Subscribe: send subscribe to [hidden email]
Unsubscribe: send unsubscribe to  [hidden email]
Detail Info: http://python.cn/mailman/listinfo/python-chinese