-
Notifications
You must be signed in to change notification settings - Fork 88
example invite, pending confirmed
This doesn’t work, but it is close. I am pretty sure it will be helpful for anyone else coming along.
Things it needs:
1. add to JoinInvitation
2. send invite
3. is there a better way to do form.user=request.user? adding it after the .save seems odd.
4. what’s a good way to delete confirmed and pendings? I couln’t figure out how to hook a form set to them without allowing edits, which seems bad.
from django import http, shortcuts, template
from django.contrib.auth.decorators import login_required
from django.forms.models import modelformset_factory
from friends.models import Contact,JoinInvitation
Contact_FormSet = modelformset_factory(Contact,
fields=(‘name’, ‘email’), extra=3)
@login_required
def user_friends_view(request):
“”“
main friends page
shows accepted, pending and a place to enter new
“”“
here is my template, which needs to be escaped and the css stripped out. I’ll clean it up in the morning.
-
{% for contact in contacts %}
-
{{contact.name}}{{contact.email}}
{% endfor %}
-
{% for form in contact_formset.forms %}
-
{{form.name}}
{{form.email}}
{{form.errors}}
{% endfor %}
-
{% for invite in inviteds %}
-
{{invite.name}}{{invite.email}}
{% endfor %}