Ejemplo n.º 1
0
    def get(self):
        email = input("  email: ")
        phone = input("  phone: ")
        first_name = input("  first name: ")
        last_name = input("  last name: ")

        first_name = FirstName.get_or_create(name=first_name)[0]
        last_name = LastName.get_or_create(name=last_name)[0]

        User.create(email=email,
                    phone=phone,
                    first_name=first_name,
                    last_name=last_name)
Ejemplo n.º 2
0
    def add(self) -> int:
        """
        Dodawnie nowych użytkownikw do bazy
        """
        first_name = FirstName.get_or_create(name=input('Podaj imię: '))[0]
        last_name = LastName.get_or_create(name=input('Podaj nazwisko: '))[0]

        first_name.save()
        last_name.save()

        client = LibraryClient(first_name=first_name, last_name=last_name)
        client.save()

        return client.id