Ejemplo n.º 1
0
def announcecontent(username,flag=0, field=0):
    postObj = Collection()
    print type(username.username)
    postObj.username = username.username
    print "inside tag "
    announcecontent = postsDal.findAnnouncements(postObj)
    print announcecontent
    return {"announcecontent" : announcecontent,"flag":flag,"field":field}
Ejemplo n.º 2
0
def updateProfile(custObj):
    try:
        #print "inside update"
        #print custObj.username
        if custObj.dbname == "an":
            if hasattr(custObj,"id"):
                print custObj.id
                model = Announcements.objects.get(user__user__username=custObj.username,ann_id=custObj.id)
            else:
                user = findCustomer(custObj)
                model = Announcements(user = user, content=custObj.fieldval)
        else:
            model = Customers.objects.get(user__username=custObj.username)
        if custObj.field == "profile":
            model.profile = custObj.image
        elif "cover" in custObj.field:
            model.cover= custObj.image
        elif "glimpse" in custObj.field:
            print "lllllllllllllllllllllllllllllllollllllllls"
            model.glimpse= custObj.image
        elif custObj.field == "desc":
            model.desc =custObj.fieldval
        elif custObj.field == "phone":
            model.phone =custObj.fieldval
        elif "content" in custObj.field:
            model.content =custObj.fieldval
        else:
            pass
        print "before save"
        print model.profile.url
        model.save()
        print "afete save"
#         customer.profile.save(custObj.profile.name,custObj.profile)
        if custObj.field == "profile":
            print "all ssfe"
            return model.profile.url
        elif custObj.field == "cover":
            return model.cover.url
        elif "glimpse" in custObj.field:
            return model.glimpse.url
        elif custObj.field == "desc":
            return model.desc
        elif custObj.field == "phone":
            return model.phone
        elif "content" in custObj.field:
            return model.content
        elif "newannounce" in custObj.field:
            print "sfsfsfsw"
            return findAnnouncements(custObj)
        else:
            pass
    except Exception as s:
        print s
        return False