Exemple #1
0
	def get_api_key(self):
		apikey = ApiKey.objects.filter(user=self.user)
		key = ""
		if apikey and apikey.count > 0:
			key = apikey[0].key
		else:
			key_obj = ApiKey()
			key_obj.user = self.user
			key_obj.save()
			keys = ApiKey.objects.filter(user=self.user)
			if keys.count > 0:
				key = keys[0].key

		return key
Exemple #2
0
    def get_api_key(self):
        apikey = ApiKey.objects.filter(user=self.user)
        key = ""
        if apikey and apikey.count > 0:
            key = apikey[0].key
        else:
            key_obj = ApiKey()
            key_obj.user = self.user
            key_obj.save()
            keys = ApiKey.objects.filter(user=self.user)
            if keys.count > 0:
                key = keys[0].key

        return key
Exemple #3
0
    def save(self):
        username = self.cleaned_data['username']
        email = self.cleaned_data['email']
        password = self.cleaned_data['password']

        user = User.objects.create_user(username, email, password)
        user.is_staff = False
        user.first_name = self.cleaned_data['firstname']
        user.last_name = self.cleaned_data['lastname']
        user.save()

        api_key = ApiKey()
        api_key.userid = self.cleaned_data['api_userid']
        api_key.vcode = self.cleaned_data['api_vcode']
        api_key.user = user
        api_key.primary_api_key = True
        api_key.valid = False
        api_key.save()

        profile = user.get_profile()
        #profile.member_type = self.cleaned_data['member_type']
        profile.save()

        return user
Exemple #4
0
    def save(self):
        username = self.cleaned_data["username"]
        email = self.cleaned_data["email"]
        password = self.cleaned_data["password"]

        user = User.objects.create_user(username, email, password)
        user.is_staff = False
        user.first_name = self.cleaned_data["firstname"]
        user.last_name = self.cleaned_data["lastname"]
        user.save()

        api_key = ApiKey()
        api_key.userid = self.cleaned_data["api_userid"]
        api_key.vcode = self.cleaned_data["api_vcode"]
        api_key.user = user
        api_key.primary_api_key = True
        api_key.valid = False
        api_key.save()

        profile = user.get_profile()
        # profile.member_type = self.cleaned_data['member_type']
        profile.save()

        return user