File: types.py

package info (click to toggle)
django-countries 7.6.1-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 3,400 kB
  • sloc: python: 3,425; sh: 29; makefile: 17
file content (31 lines) | stat: -rw-r--r-- 906 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
import graphene  # type: ignore


class Country(graphene.ObjectType):
    name = graphene.String(description="Country name")
    code = graphene.String(description="ISO 3166-1 two character country code")
    alpha3 = graphene.String(description="ISO 3166-1 three character country code")
    numeric = graphene.Int(description="ISO 3166-1 numeric country code")
    ioc_code = graphene.String(
        description="International Olympic Committee country code"
    )

    @staticmethod
    def resolve_name(country, info):
        return country.name

    @staticmethod
    def resolve_code(country, info):
        return country.code

    @staticmethod
    def resolve_alpha3(country, info):
        return country.alpha3

    @staticmethod
    def resolve_numeric(country, info):
        return country.numeric

    @staticmethod
    def resolve_ioc_code(country, info):
        return country.ioc_code