Changeset 11

Show
Ignore:
Timestamp:
01/04/07 17:03:21 (5 years ago)
Author:
nicolast
Message:

- Model help texts
- Login system

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/djangoid/server/models.py

    r8 r11  
    2424        expires = models.IntegerField() 
    2525 
    26         class Admin: 
    27                 pass 
    28  
    2926class OidStoreAssociation(models.Model): 
    3027        server_url = models.TextField() 
     
    3532        assoc_type = models.CharField(maxlength = 64) 
    3633 
    37         class Admin: 
    38                 pass 
    39  
    4034        class Meta: 
    4135                #Django got no multi-column primary keys 
     
    4539        setting = models.CharField(maxlength = 128, primary_key = True) 
    4640        value = models.TextField() 
    47  
    48         class Admin: 
    49                 pass 
  • trunk/djangoid/server/views.py

    r10 r11  
    1919from django.conf import settings 
    2020from django.shortcuts import render_to_response 
     21from django.contrib.auth.views import redirect_to_login 
    2122from djangoid.users.models import DjangoidUser 
    2223from djangoid.openidhandlers import checkYadisRequest, convertToOpenIDRequest, convertToHttpResponse, handleOpenIDRequest  
    2324import re 
     25import urllib 
    2426 
    2527#Regex to extract username out of identity delegate URI, like 
     
    5961                #Make sure we pass all OpenID related information in the URL 
    6062                if not request.user or request.user.is_authenticated() == False: 
    61                         return HttpResponseRedirect(r.encodeToURL(settings.BASE_URL + "login/")
     63                        return redirect_to_login(urllib.quote(r.encodeToURL("/".join([""] + settings.BASE_URL.split("/")[3:]))), login_url = settings.BASE_URL + "login/"
    6264                if not request.user.username == user.djangouser: 
    6365                        raise Exception, "Logged in as " + request.user.username + " while expecting " + user.djangouser 
  • trunk/djangoid/urls.py

    r8 r11  
    2424    (r'^yadis/$', 'djangoid.server.views.serveryadis'), 
    2525    (r'^admin/', include('django.contrib.admin.urls')), 
    26     (r'^login/$', 'djangoid.users.views.login'), 
     26    (r'^login/$', 'django.contrib.auth.views.login', {"template_name": "users/login.html"}), 
    2727    (r'^accept/$', 'djangoid.users.views.accept'), 
    2828    (r'^(?P<uid>[^/]+)/yadis/$', 'djangoid.users.views.useryadis'), 
     29    (r'^(?P<uid>[^/]+)/foaf/$', 'djangoid.users.views.userfoaf'), 
    2930    (r'^(?P<uid>[^/]+)/$', 'djangoid.users.views.userpage'), 
    3031    (r'^$', 'djangoid.server.views.endpoint'), 
  • trunk/djangoid/users/models.py

    r10 r11  
    2121#Represent one trusted root URI. Can be shared between several users. 
    2222class TrustedRoot(models.Model): 
    23         root = models.URLField(primary_key = True) 
     23        root = models.URLField("Trusted root URI", primary_key = True) 
    2424 
    2525        def __str__(self): 
     
    3434        #djangouser = models.ForeignKey(User, primary_key = True) 
    3535        #So using an ugly hack... TODO: Fixme! 
    36         djangouser = models.CharField('username', maxlength = 30, primary_key = True
    37         trusted_roots = models.ManyToManyField(TrustedRoot, blank = True, null = True
     36        djangouser = models.CharField('Django user username', maxlength = 30, primary_key = True, help_text = "This should be the username of an existing user in the django.contrib.auth system"
     37        trusted_roots = models.ManyToManyField(TrustedRoot, blank = True, null = True, help_text = "URI's trusted by this user"
    3838 
    3939        def __str__(self): 
     
    5555#Identities can have attributes. These items represent one possible attribute. 
    5656class IdentityAttribute(models.Model): 
    57         name = models.CharField(maxlength = 128
    58         title = models.CharField(maxlength = 128
    59         namespace = models.CharField(maxlength = 32
    60         description = models.TextField(blank = True
    61         regex = models.CharField(maxlength = 128, blank = True
     57        name = models.CharField("Name", maxlength = 128, help_text = "Name of the attribute. In \"openid.sreg.nickname\" this is \"nickname\""
     58        title = models.CharField("Title", maxlength = 128, help_text = "Title of the attribute, as displayed to the user"
     59        namespace = models.CharField("Namespace", maxlength = 32, help_text = "Namespace of the attribute. In \"openid.sreg.nickname\" this is \"sreg\""
     60        description = models.TextField("Description", blank = True, help_text = "Longer description of the attribute, as displayed to the user"
     61        regex = models.CharField("Validation regex", maxlength = 128, blank = True, help_text = "Regex the value of this field is validated upon on updates"
    6262 
    6363        def __str__(self): 
     
    7272#This maps an attribute to a user, including a value, obviously 
    7373class UserAttribute(models.Model): 
    74         user = models.ForeignKey(DjangoidUser
    75         attribute = models.ForeignKey(IdentityAttribute
    76         value = models.TextField(
     74        user = models.ForeignKey(DjangoidUser, help_text = "DjangoidUser this attribute value belongs to"
     75        attribute = models.ForeignKey(IdentityAttribute, help_text = "Attribute of which this is the value for this user"
     76        value = models.TextField("Value"
    7777        #True if this attribute's value may be displayed to all trust roots 
    78         public = models.BooleanField(
     78        public = models.BooleanField("Public", help_text = "If this is true, this attribute is returned in all authentication requests, of all trust roots"
    7979        #List of specific trust roots this attribute may be displayed to. 
    8080        #If "public" is True, this got no meaning at all 
    81         public_for = models.ManyToManyField(TrustedRoot, blank = True, null = True
     81        public_for = models.ManyToManyField(TrustedRoot, blank = True, null = True, help_text = "List of all trust roots this value should be displayed to. If \"public\" is true, this list got no value"
    8282 
    8383        def __str__(self):