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
1 answer

django profile creation, set User profile while using multiple profile types

I am stuck at user registration, I actually intends to have different profile types. While registration I am unable to set UserProfile while creating a user. I am using UserCreationForm. code in my files are as following. from…
Hafiz
  • 4,187
  • 12
  • 58
  • 111
1
vote
2 answers

django profies and request.user - error

I'm getting the following error: 'AnonymousUser' object has no attribute 'get_profile' after I added the following middleware, and try to log on to my site without having logged on before: class TimezoneMiddleware(object): def…
mb52089
  • 872
  • 2
  • 10
  • 24
0
votes
2 answers

django gets a 404 page when I try to access django-registration

Hello and thank you in advance, When I installed django-profiles and django-registration. I believe I followed a tutorial correctly on how to configure them: http://agiliq.com/books/djenofdjango/chapter5.html#reusable-apps Now when I try to access…
dpbklyn
  • 781
  • 3
  • 10
  • 19
0
votes
1 answer

Django_Profiles won't automatically create profile, other errors

I'm working on my first Django project and employing django-registration and django-profiles. The former worked beautifully with nary an issue. The second has been a bit more problematic. After many hours, specific user profiles can finally be…
Why Not
  • 603
  • 3
  • 14
  • 25
0
votes
1 answer

django-profile passing variables to template

Django newbie at work and I could use some pointers. I'm using django-profile and have been working on my profile page which is handled by the views.profile_detail. The problem I am facing is I am unable to put another variable in my template by…
rawfish.dev
  • 319
  • 3
  • 13
0
votes
1 answer

How to handle django static files for production

I am a newbie django developer and this is the django project i will be deploying. Everything works in development but I am been having issues in production. PS: I am using shared hosting for the deployment. First, the website loads but images are…
0
votes
1 answer

RelatedObjectDoesNotExist at /auth/profile/ User has no profile. (user is creating but profile is not)

I had created a custom registration form through which I am creating User and I want to create a profile of the user while creating a User. The code is working if I create a profile manually through admin but not creating while creating user. below…
0
votes
1 answer

How to get previous saved data while editing profile page in django

while editing my profile page ,i get blank page but i want previous saved data. forms.py class UserEditForm(forms.ModelForm): class Meta: model=User fields=['first_name','last_name','email'] class…
0
votes
0 answers

Django post save function not able to save role id in profile model

I am creating user in django, on post save using reciever signal to save the Profile, I have profile model like this: class Profile(models.Model): user = models.OneToOneField(base_settings.AUTH_USER_MODEL,on_delete=models.CASCADE) …
0
votes
2 answers

Django: Display each user's profile

I'm new to Django and I'm trying to display each user's profile. So far, I've made a sign-in, sign-up system. User can also update their profiles but I'm really not able to show each user's profile as soon as the logged in user clicks on the other…
0
votes
1 answer

RelatedObjectDoesNotExist at /esacp/profile/ User has no profile in Django

So I have almost completed my Django app. But whenever I create the new user, his/her profile is not created automatically and when I open the profile after logging in, I get this error RelatedObjectDoesNotExist at /esacp/profile/ User has no…
Khubaib Khawar
  • 51
  • 1
  • 11
0
votes
1 answer

Accessing SubClassed User Profile Module in Django 1.3

I am trying to create two user types in django 1.3. I am subclassing the AUTH_PROFILE_MODULE with the following models.py: class Member(models.Model): ROLE_CHOICES = ( (0, 'Guide'), (1, 'Operator'), ) user =…
thesteve
  • 2,413
  • 6
  • 26
  • 28
0
votes
1 answer

Django models: how to manage field flags

I need to create a User Profile. To ensure privacy many fields in this profile will be "hidable": every User will be able to hide these information. I can use https://github.com/disqus/django-bitfield, but i would like to know if it's possibile to…
vad
  • 1,196
  • 9
  • 22
0
votes
1 answer

Django retrieve all comments for a user

I'm using django-profiles and django.contrib.comments and I am trying to display all comments for a particular user in their profile. This is using the default profile_detail view from django-profiles. I've tried these two approaches and neither is…
0
votes
1 answer

django-registration creating blank django-profiles using signals

I have gone through the solution here and Shacker's django-profiles: The Missing Manual and subsequent signals solution by Dmitko and answers here and many places. Here are the details: AUTH_PROFILE_MODULE = "members.Profile" From…