Permalink
Browse files

renamed all instances of Contact to TransientContact

  • Loading branch information...
1 parent cd550f4 commit c8d18d9fcc92ce73ba3e49fcbdf2d80906ab0173 @brosner brosner committed Apr 15, 2010
Showing with 15 additions and 12 deletions.
  1. +3 −3 contacts_import/admin.py
  2. +6 −3 contacts_import/backends/persistance.py
  3. +3 −3 contacts_import/tests.py
  4. +3 −3 contacts_import/views.py
View
@@ -1,10 +1,10 @@
from django.contrib import admin
-from contacts_import.models import Contact
+from contacts_import.models import TransientContact
-class ContactAdmin(admin.ModelAdmin):
+class TransientContactAdmin(admin.ModelAdmin):
pass
-admin.site.register(Contact, ContactAdmin)
+admin.site.register(TransientContact, TransientContactAdmin)
@@ -1,4 +1,4 @@
-from contacts_import.models import Contact
+from contacts_import.models import TransientContact
class BasePersistance(object):
@@ -22,8 +22,11 @@ def default_status(self):
}
def persist_contact(self, contact, status, credentials):
- obj, created = Contact.objects.get_or_create(user=credentials["user"],
- email=contact["email"], defaults={"name": contact["name"]})
+ obj, created = TransientContact.objects.get_or_create(
+ user = credentials["user"],
+ email = contact["email"],
+ defaults = {"name": contact["name"]}
+ )
status["total"] += 1
if created:
status["imported"] += 1
View
@@ -3,7 +3,7 @@
from django.contrib.auth.models import User
-from contacts_import.models import Contact
+from contacts_import.models import TransientContact
class BasicTest(TestCase):
@@ -29,9 +29,9 @@ def tests_views(self):
self.assertEqual(response.status_code, 302)
def test_contact_display(self):
- Contact.objects.create(user=self.bob, name="Bjarne Stroustrup",
+ TransientContact.objects.create(user=self.bob, name="Bjarne Stroustrup",
email="bjarne@making.life.hard.com")
- Contact.objects.create(user=self.bob, name="Guido van Rossum",
+ TransientContact.objects.create(user=self.bob, name="Guido van Rossum",
email="guido@python.org")
response = self.client.get(reverse("import_contacts"))
View
@@ -12,7 +12,7 @@
from contacts_import.forms import VcardImportForm
from contacts_import.backends.importers import GoogleImporter, YahooImporter
-from contacts_import.models import Contact
+from contacts_import.models import TransientContact
from contacts_import.settings import RUNNER, CALLBACK
@@ -76,12 +76,12 @@ def import_contacts(request, template_name="contacts_import/import_contacts.html
return HttpResponseRedirect("%s?page=%s" % (request.path, page_num-1))
elif "finish" in request.POST:
if not selected:
- Contact.objects.filter(user=request.user).delete()
+ TransientContact.objects.filter(user=request.user).delete()
return HttpResponseRedirect(reverse("import_contacts"))
# give control over to the callback which is required to
# return a HttpResponse
response = callback(request, selected)
- Contact.objects.filter(user=request.user).delete()
+ TransientContact.objects.filter(user=request.user).delete()
return response
else:
form = VcardImportForm()

0 comments on commit c8d18d9

Please sign in to comment.