1

에 연락처를 저장하고 싶습니다. Google API v3. 나는이 데이터를 저장하는 가장 좋은 방법이 무엇인지, 그리고 이미 모델이있는 경우 특히 알고 싶습니다.appengine 데이터 스토어 용 Google 연락처의 Python 모델

the sources of gdata을 보면 매우 흥미로운 시작을 발견했습니다. 그러나 이것은 데이터 저장소가 아닌 파이썬에서만 데이터 모델링입니다.

질문 :이 모델은 이미 Python에 존재합니까?

그렇지 않은 경우 :

질문 : 처음부터 다시 시작하는 가장 좋은 방법은 무엇입니까?

파이썬에서 연락처의 예부터 :

class Contact(db.Model): 
    """ 
    https://developers.google.com/gdata/docs/2.0/elements?hl=fr#gdContactKind 
    https://developers.google.com/appengine/docs/python/datastore/datamodeling 
    """ 

    content = db.Text() 
    """atom:content Notes about the contact.""" 

    link = db.ListProperty(Link,indexed=False,default=[]) 
    """atom:link* Links to related information. Specifically, atom:link[@rel='alternate'] links to an HTML page describing the contact.""" 

    title = db.StringProperty() 
    """atom:title Contact's name. This field is read only. To modify the contact's name, see gd:name.""" 

    email = db.ListProperty(Email,indexed=False,default=[]) 
    """gd:email* Email addresses.""" 

    """etc...""" 

class Link(db.Model): 
    """ 
    Link 
    """ 
    link = db.LinkProperty() 

class Email(db.Model): 
    """ 
    Email 
    """ 
    email_address = db.EmailProperty() 


class EmailImParent(db.Model): 
    address = db.StringProperty() 
    label = db.StringProperty() 
    rel = db.StringProperty() 
    primary = db.StringProperty() 


class Email(db.Model,EmailImParent): 
    """ 
    The gd:email element. 
    """ 
    email = db.EmailProperty() 
    display_name = db.StringProperty() 

답변

0

나는 모든 사람들이 자신의 압연 생각합니다. 할 수있는 일은 간단합니다. AE-BaseApp/Python을보고 Github 링크에서 코드를 확인하십시오. 연락처 모델에 대한 몇 가지 개선 사항이 포함 된 가까운 미래에 업데이트 될 새로운 코드가 있습니다. (업데이트 된 코드는 현재 해킹으로 인해 http와 https 모두에서 작동하는 로그인을 얻지 못해 here)

+0

나는 코드를 보았지만 Contact 엔티티와 관련된 항목을 찾지 못했습니다. '/ models /'디렉토리에 엔티티를 추가 할 계획입니까? – Yohann

+0

UserProfile.py 파일을보십시오. 이 애플리케이션의 연락처에 내가 사용하고있는 것입니다. 나는 당신이 기술적으로 필요하지 않은 미래의 API를 위해 ProfileCrud라는 클래스를 만들었습니다. 많은 부분을 수정한다고는 생각지 못했지만 ProfileCrud 호출에서 상속 한 정의에 사용자 ID 변수를 추가해야 할 경우 해당 클래스의 정의만으로도 벗어날 수 있습니다. 또한 클래스에 대한 추가 조회가없는 성능 향상도 있습니다. 아직 벤치 마크하지 않았지만 중요한지는 알고 있지만 알고 있어야합니다. –

관련 문제