Created
May 9, 2016 11:19
-
-
Save MartijnBraam/22054257651193d319917c4073aa97b5 to your computer and use it in GitHub Desktop.
Drupal services python module example
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
shop = DrupalService('http://brixit.nl/api', 'username', 'password') | |
class Article(Node): | |
body = BodyTextField() | |
image = ImageField(machine_name='field_image') | |
tags = TermReferenceField(machine_name='field_tags', limit=0, vocabulary='labels') | |
class Meta: | |
drupal = shop | |
example = Article.get(49) | |
example.author = 'Martijn' | |
example.save() | |
blog_post = Article() | |
blog_post.author = "Martijn" | |
blog_post.body.value = "Test" | |
blog_post.image.load_existing_file(fid=21) | |
blog_post.save() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment