Tuesday, September 30, 2014

Re: Custom User

use list_display:

https://docs.djangoproject.com/en/dev/ref/contrib/admin/#django.contrib.admin.ModelAdmin.list_display

Cheers
L.

On 1 October 2014 13:11, Sachin Tiwari <sachin.tiwari50@gmail.com> wrote:
> Ok sorry for incomplete description, I added a field phone number in user
> profile for eg when we click on add user button it will show username,
> password and in my case it will show phone number also but it will not be
> displayed after saving it.
>
> I add
>
> from django.contrib.auth.models import User
>
> class Employee(models.Model):
> user = models.OneToOneField(User)
> phone_no = models.IntegerField(max_length=10)
>
> This code in admin.py
>
> class EmployeeInline(admin.StackedInline):
> model = Employee
> can_delete = False
> verbose_name_plural = 'phon_no'
>
> # Define a new User admin
> class UserAdmin(UserAdmin):
> inlines = (EmployeeInline, )
>
> # Re-register UserAdmin
> admin.site.unregister(User)
> admin.site.register(User, UserAdmin)
>
> Now I want to show it with main users list page.
>
>
> On Tuesday, September 30, 2014 3:20:34 PM UTC+5:30, Sachin Tiwari wrote:
>>
>> Hi
>>
>> I want to display a phone number field at users list page,
>>
>> Username emailAddress FirstName LastName staffstatus PhoneNumber
>> sachin abc@g.com sachin tiwari True
>> 00000000000
>>
>>
>>
>>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscribe@googlegroups.com.
> To post to this group, send email to django-users@googlegroups.com.
> Visit this group at http://groups.google.com/group/django-users.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/b8afc4e7-9537-466b-9a2b-21047c2476bb%40googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.



--
You have to be really clever to come up with a genuinely dangerous
thought. I am disheartened that people can be clever enough to do that
and not clever enough to do the obvious thing and KEEP THEIR IDIOT
MOUTHS SHUT about it, because it is much more important to sound
intelligent when talking to your friends.
This post was STUPID.
-----------------------------------------------------------------------------------------------------------
The Most Terrifying Thought Experiment of All Time
http://www.slate.com/articles/technology/bitwise/2014/07/roko_s_basilisk_the_most_terrifying_thought_experiment_of_all_time.html

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/CAGBeqiM09QKNF8_C72tGAgPOodZPX1M6TzV1fR0kn_fY3emvmw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment