Changeset - aafd9a98ea58
[Not reviewed]
default
0 2 0
Marcin Kuzminski - 15 years ago 2010-07-01 18:17:52
marcin@python-works.com
added admin flag to users editing
2 files changed with 6 insertions and 0 deletions:
0 comments (0 inline, 0 general)
pylons_app/model/forms.py
Show inline comments
 
@@ -221,24 +221,25 @@ class LoginForm(formencode.Schema):
 

	
 

	
 
    #chained validators have access to all data
 
    chained_validators = [ValidAuth]
 
    
 
def UserForm(edit=False):
 
    class _UserForm(formencode.Schema):
 
        allow_extra_fields = True
 
        filter_extra_fields = True
 
        username = All(UnicodeString(strip=True, min=3, not_empty=True), ValidUsername)
 
        if edit:
 
            new_password = All(UnicodeString(strip=True, min=3, not_empty=False), ValidPassword)
 
            admin = StringBoolean(if_missing=False)
 
        else:
 
            password = All(UnicodeString(strip=True, min=3, not_empty=False), ValidPassword)
 
        active = StringBoolean(if_missing=False)
 
        name = UnicodeString(strip=True, min=3, not_empty=True)
 
        lastname = UnicodeString(strip=True, min=3, not_empty=True)
 
        email = Email(not_empty=True)
 
        
 
    return _UserForm
 

	
 
def RepoForm(edit=False):
 
    class _RepoForm(formencode.Schema):
 
        allow_extra_fields = True
pylons_app/templates/admin/users/user_edit.html
Show inline comments
 
@@ -40,20 +40,25 @@
 
        	</tr>
 
        	<tr>
 
        		<td>${_('Email')}</td>
 
        		<td>${h.text('email')}</td>
 
        		<td>${self.get_form_error('email')}</td>
 
        	</tr>        	        	
 
        	<tr>
 
        		<td>${_('Active')}</td>
 
        		<td>${h.checkbox('active',value=True)}</td>
 
        		<td>${self.get_form_error('active')}</td>
 
        	</tr>
 
        	<tr>
 
        		<td>${_('Admin')}</td>
 
        		<td>${h.checkbox('admin',value=True)}</td>
 
        		<td>${self.get_form_error('admin')}</td>
 
        	</tr>        	
 
        	<tr>
 
        		<td></td>
 
        		<td>${h.submit('save','save')}</td>
 
        	</tr>
 
        	        	        	
 
        </table>
 
        ${h.end_form()}
 
    </div>
 
</%def>  
 
\ No newline at end of file
0 comments (0 inline, 0 general)