Questions tagged [django-profiles]

Django-profiles is a module that allows you to add additional fields that extend the "out of the box" User Profile provided by Django.

Explanation of django-profiles

django-profiles is a module that allows you to add additional fields that extend the "out of the box" User Profile provided by Django.


Steps to Implement Module

1. Modify Settings

settings.py

AUTH_PROFILE_MODULE = 'application_name.UserProfile'

2. Add Routing

urls.py

(r'^profiles/', include('profiles.urls'))

3. Add Form Fields

forms.py

class ProfileForm(ModelForm):

twitter = forms.CharField(label="Twitter")
about = forms.CharField(label="About", widget=forms.Textarea)
url = forms.CharField(label="URL")

4. Add View

views.py

Write the view for the edit_profile

5. Create Templates

  • profiles/create_profile.html
  • profiles/edit_profile.html
  • profiles/profile_detail.html
  • profiles/profile_list.html

Download Code

https://bitbucket.org/ubernostrum/django-profiles

Additional Resources

django-profiles: The Missing Manual

Further Tips

  • If you are adding an ImageField to your profile model, chmod -R 755 that folder

avatar = models.ImageField(upload_to = 'avatar/')

Note: If you have /avatar/ then you will get a SuspiciousOperation exception

  • In your template add enctype="multipart/form-data" in form tag.

<form method="post" action="." enctype="multipart/form-data">

To display the image add something similar to the example below <img id="avatar" src="/media/{{ profile.avatar }}" />

66 questions
0
votes
1 answer

passing variable to django custom template tag

Im using django-profiles. In my profile_detail template I know that I will receive a profile variable. I want to make a custom tag that gets the content per user via user id. Like this: {% get_user_content book.review profile.user.id as review_list…
Ronnie Beltran
  • 614
  • 1
  • 8
  • 21
0
votes
0 answers

Getting profile data user without additional model

I have the User customize model to several roles or users types such as: Student user Professor User Executive User My User model is of this way: class User(AbstractBaseUser, PermissionsMixin): email = models.EmailField(unique=True) …
bgarcial
  • 2,915
  • 10
  • 56
  • 123
0
votes
1 answer

In Django admin, can I prevent added user profile fields from appearing on "Add user" page?

I created a profile model that contains additional fields for the User model. It works as expected, but when I add a new user, the added fields appear on both the "Add user" page (first page) and the "Change user" page (second page). How can I…
Mike
  • 150
  • 1
  • 8
0
votes
2 answers

Django passing user profile data from client to server

I am using a custom User model with an user profile using a OneToOneField with this structure : email password profile : { username avatar } It works pretty good for mobile because I just basically send json back and forth, but it's a…
Swann
  • 2,413
  • 2
  • 20
  • 28
0
votes
1 answer

Profile pages design based on login in Django

I m developing an application that requires a profile page based on user login. May be, this is a repeated question, but I haven't got an Idea about how to do this from other questions on this site. Problem1: User should have access only to his…
0
votes
3 answers

Change user email in Django without using django-profiles

In my Django application I would like the user to be able to change the email address. I've seen solution of StackOverflow pointing people to django-profiles. Unfortunately I don't want to use a full fledged profile module to accomplish a tiny feat…
0
votes
1 answer

I can't display extended values of my user model

On this case my problem arise displaying extended values of my user model in my index.html here my models.py from django.db import models from django.contrib.auth.models import User def url(self,filename): ruta =…
Jhonny
  • 145
  • 1
  • 12
0
votes
1 answer

Django - Integrating django-profiles (and django-registration) with django-facebook

[Django 1.5.1] I've set up django-profiles and django-registration for my small site in a way that involves a 'custom' registration backend such that during registration, a new user fills out their username, password, and profile fields in one go.…
0
votes
1 answer

Django profile attributes not shown in template

For some reason I can not get custom user profiles to work. The following is what I tried: models.py: class UserProfile(models.Model): #user = models.ForeignKey(User, unique=True) user = models.OneToOneField(User) program =…
szeta
  • 589
  • 1
  • 5
  • 21
0
votes
1 answer

Multiple User Profile with Django Userena

I'm using userena 1.2 and Django 1.4. I'm trying to create multiple user profiles but I had no luck following many post found here on SO. I've create 2 custom Models and a form like so: class BaseProfile(UserenaBaseProfile): """ Default profile…
Leonardo
  • 4,046
  • 5
  • 44
  • 85
0
votes
1 answer

Using django-profiles with Django 1.5

I am working again on a Django 1.4 project which I am trying to get working with 1.5. I was using the module django-profiles, unfortunately the module is using Django generic views (list_detail particularly) and they aren't supported anymore in 1.5…
Mathieu Marques
  • 1,678
  • 15
  • 33
0
votes
1 answer

Problems updating user profiles

Working out editing profiles and ran into a little trouble! The following piece of code succesfully updates the mug_shot column in the user profile, but also erases all the other column data for that particular record. It's weird because Django is…
Matt H
0
votes
1 answer

Overriding Django profiles' profile_detail view

I installed django profiles/registration and everything seems to be fine. When a user registers their profile is created also. Now what i want to do is query another Model which is Company based on the user id of User. I dont want to change…
shaytac
  • 3,789
  • 9
  • 36
  • 44
0
votes
1 answer

Django user profile query

I have been struggling to see what is wrong with this code for couple hours now. The project i m working on calls for users to register to the sites (taken care of by Django registration plugin.) Once registered, users will be able to add their…
shaytac
  • 3,789
  • 9
  • 36
  • 44
0
votes
1 answer

Order object_list with django-profiles

Using the django-profiles app, I want to display the users' profiles in an ordered list. Ordered by different fields, depending on the situation. Now the docs say something about passing extra arguments to the views here but I don't know how to do…
black_puppydog
  • 950
  • 13
  • 21