I need some more info :)

I've get this: http://img138.imageshack.us/img138/200/descargan.png it's
pretty but need to change somethings...

   1. *I need that user be a EmailField unique. User is defined in auth.User
   so I don't know how change it.*
   2. In "User Profiles" I like to change the title, and delete "User
   Profile: #1" because it's a 1-1 relation between my create UserProfile and
   the auth.User

This is my code:

models.py

from django.db import models
from django.contrib.auth.models import User

class UserProfile(models.Model):
    BUSINESS_SIZE_CHOICES = (
        ('1', '1 to 10 employees'),
        ('11', '11 to 50 employees'),
        ('51', '51 to 250 employees'),
        ('251', '251 and above employees'),
    )

    user = models.ForeignKey(User, unique=True)

    #email = models.EmailField(unique=True, help_text='Unique email, you
can\'t reuse it in another profile.')
    sector = models.CharField(max_length=100, help_text='Business sector of
activity.')
    countries = models.CharField(max_length=100, help_text='Countries where
the business are.')
    business_activity = models.CharField(max_length=100, help_text='Your
business principal activity.')
    business_size = models.SmallIntegerField(choices=BUSINESS_SIZE_CHOICES,
help_text='Choose your aproximately business size.')
    business_description = models.TextField(help_text='Little description
about your business, some as a "Elevator Pitch".')
    ranking = models.CharField(max_length=50, help_text='Your ranking in the
business. Example: CEO, CKO...')
    linkedin = models.CharField(max_length=50, help_text='Your linkedin
profile.')
    twitter = models.CharField(max_length=50, help_text='Your twitter
profile.')
    xing = models.CharField(max_length=50, help_text='Your xing profile.')

And this is my admin.py

from networking.lukkom.models import UserProfile
from django.contrib.auth.models import User
from django.contrib import admin

class UserProfileAdmin(admin.StackedInline):
    model = UserProfile
    fields = ['sector', 'countries', 'business_activity', 'business_size',
'business_description', 'ranking', ]

class UserAdmin(admin.ModelAdmin):
    fieldsets = [
        (None, {'fields': ['username', 'password']}),
        ('Advanced', {'fields': ['is_staff', 'is_active', 'is_superuser',
'last_login', 'date_joined'], 'classes': ['collapse']}),
    ]
    inlines = [UserProfileAdmin]

admin.site.unregister(User)
admin.site.register(User, UserAdmin)


2010/5/18 Alexandre González <a...@mirblu.com>

> Perfect, thanks for your help!
>
>
> On Tue, May 18, 2010 at 14:03, zinckiwi <zinck...@gmail.com> wrote:
>
>> On May 18, 7:57 am, Alexandre González <a...@mirblu.com> wrote:
>> > But don't you think that have attributes that I don't need is a
>> perfomance
>> > lost? I only ask, I'm learning django :)
>> >
>> > I go to see the documentation that you send me, thanks for your help.
>>
>> There will be a minuscule amount of overhead from the query for User
>> objects referring to fields you don't use, but I mean *really*
>> minuscule. Unmeasurable unless you are Twitter. Don't worry about it.
>>
>> Regards
>> Scott
>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "Django users" group.
>> To post to this group, send email to django-us...@googlegroups.com.
>> To unsubscribe from this group, send email to
>> django-users+unsubscr...@googlegroups.com<django-users%2bunsubscr...@googlegroups.com>
>> .
>> For more options, visit this group at
>> http://groups.google.com/group/django-users?hl=en.
>>
>>
>
>
> --
> Please, don't send me files with extensions: .doc, .docx, .xls, .xlsx, .ppt
> and/or .pptx
> http://mirblu.com
>



-- 
Please, don't send me files with extensions: .doc, .docx, .xls, .xlsx, .ppt
and/or .pptx
http://mirblu.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-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.

Reply via email to