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
1
vote
2 answers

Adding ImageField to Django Models Results in Error

I'm currently working on my first Django project and have hit a roadblock in regard to adding an ImageField to an existing model. I currently have a model for a user posting content and one for django-profiles. For the former, I added an ImageField…
Why Not
  • 603
  • 3
  • 14
  • 25
1
vote
1 answer

How do staff users edit their profiles in Django admin?

I'm new to Django. I'm working on a website that will only contain users as staff users. I'm the administrator. My plan is to register a user and give him his username and password to login; I want him only to be able to edit his profile to add more…
Yasmeen
  • 168
  • 1
  • 2
  • 12
1
vote
2 answers

django-profiles and nonetype user

I am stumped! I am building a form that allows the user to fill in profile fields and user fields at the same time. There are examples all over the web for this and a number on this site (eg How to create a UserProfile form in Django with…
1
vote
1 answer

How the datas are connected to the specific user ID?

I'm new to Django and python. I've done login forms but I need to know. How can I connect the contents of the page with the user. For example: It's a Q&A site. When you logged in, It shows profile page with the questions that user asked before. How…
rnk
  • 2,174
  • 4
  • 35
  • 57
1
vote
1 answer

Django: Changing User Profile by forms

I am using UserProfile to save some fields that I created. Its working fine. But I would like to create a new view to let user change (update) theses fields values. But, theses values arent being showing in form. Anyone have any idea how to fix…
Thomas
  • 2,256
  • 6
  • 32
  • 47
1
vote
1 answer

Profile page is showing error under postlist href since pk number is increasing?

in blog page, i have made profile pages link for every user. there is also a view for userlist where users linked to their own profile page. here is my blog/models.py: class Post(models.Model): title = models.CharField(max_length=255) …
1
vote
1 answer

How can I add user profile support to a google app engine app?

I have a Google App Engine app based on django / django_appengine that I wish to modify by adding user profile support to it, because the basic user model is a bit simplistic for my situation. What's the best way to do this?
Chris R
  • 17,546
  • 23
  • 105
  • 172
1
vote
1 answer

File upload with django-profiles

I'm using the django-contrib package django-profiles, and everything is working great - my only issue is that I would like the form to upload a file (for an avatar), unfortunately - the form does not upload the file. Has anyone successfully managed…
Martin
  • 118
  • 1
  • 6
1
vote
1 answer

DRY approach to add user information without using Auth.user in Django

I'm writing an application where I need to register user information even if the user does not exists (yet) in Django. Basically I need to insert almost every fields used by Auth.user (I don't care about password). I've also created a Profile model…
Leonardo
  • 4,046
  • 5
  • 44
  • 85
1
vote
1 answer

Django form checkbox to change a value in UserProfile

I'm using Django-Profiles with Django 1.4, and I need a way to unsubscribe a user, so they can stop getting emails. One of the fields in my UserProfile model is user_type, and I have a USER_TYPES list of choices. To keep users in the system, even…
Anthony Roberts
  • 1,971
  • 1
  • 19
  • 34
1
vote
3 answers

Django custom user model: How to manage staff permissions?

I'm trying to benefit from Django 1.5 and created custom user model. In order to use builtin permissions, which I would like to limit access with in the admin interface. I inherited my user class also from PermissionMixin. But when I create new user…
Vlad T.
  • 2,568
  • 3
  • 26
  • 40
1
vote
2 answers

Integrating django-profiles with django-registration

I'm still a newbie when it comes to django, but I've installed both django-profiles and django-registration, and running the latest django 1.5.1. I've also read a few guides, namely http://dmitko.ru/django-registration-form-custom-field/,…
Stylex
  • 73
  • 8
1
vote
4 answers

Django admin: How to allow users to edit the profile?

I tried to implement the code for editing the Django admin panel. It ran without any errors, but it did not update the relevant data fields in the database. Here is my code for updating the database table. views.py @login_required def…
Lahiruzz
  • 665
  • 1
  • 12
  • 24
1
vote
3 answers

Creating Title / Slug based on PK ID

What would be the generic way to create record title and slub based on the ID? I am working with django-photologue here. I want to save a record with title and slug based on the PK. The generic problem is that I can't get the PK until the record is…
mdrozdziel
  • 5,528
  • 6
  • 39
  • 55
1
vote
1 answer

Accessing objects parent property in django profiles

I am using django profiles with having different types of profiles. My Profile Model of Company is similar to: from django.db import models from django.contrib.auth.models import User from accounts.models import UserProfile from jobs.models import…
Hafiz
  • 4,187
  • 12
  • 58
  • 111