Example #1
0
 def getSubscriber(self, mobile):
     try:
         subscriber = Subscriber.objects.get(mobile=mobile)
     except Subscriber.DoesNotExist:
         subscriber = Subscriber(mobile=mobile)
         subscriber.save()
     return subscriber        
Example #2
0
 def parse_contacto(self, linea):
     from addressbook.models import Contacto
     self.index = 0
     nombre, apellidos = self.get_datos(linea, 2)
     self.contacto, self.created = Contacto.objects.get_or_create(nombre = nombre, apellidos = apellidos, usuario = self.user)
     if self.channel:
         if self.contacto.tlf_movil():
             Subscriber.create(self.contacto.tlf_movil(), self.channel.id, nombre)
     self.parse_data(linea)
     self.total += 1
Example #3
0
 def test_delete_subscriber(self):
     username = self.username
     password = '******'
     resp = self.client.post( reverse('root'), {'username':username,'password':password})
     self.failUnlessEqual( resp.status_code, 200 )
     sub = Subscriber(name='nameTest',mobile='649868997')
     sub.save()
     sub.channels=[1]
     sub.save()
     resp = self.client.get(reverse('ajaxDeleteSubscriber'),{'checked':[1]},**{'HTTP_X_REQUESTED_WITH': 'XMLHttpRequest'})
     self.assertNotEqual( resp.status_code, 404 )
     dats = simplejson.loads(resp.content)
     if dats['data'] == True:
         self.assertEqual
     else:
         self.fail('Not delete object')