| author | rougeronj |
| Fri, 22 May 2015 12:37:37 +0200 | |
| changeset 90 | faf2cdb47813 |
| parent 71 | a5dedc11ba8f |
| child 102 | 622f5d1955b6 |
| permissions | -rw-r--r-- |
|
45
19f3f0a7fbd7
add idInventory for slides saved from a research and not coming from Jamespot
rougeronj
parents:
21
diff
changeset
|
1 |
import datetime |
|
19f3f0a7fbd7
add idInventory for slides saved from a research and not coming from Jamespot
rougeronj
parents:
21
diff
changeset
|
2 |
|
| 13 | 3 |
from django.db import models |
4 |
from taggit.managers import TaggableManager |
|
|
21
4e9e005bce90
update ammico user attribute to OnetoOneField instead of foreign key
rougeronj
parents:
20
diff
changeset
|
5 |
|
| 51 | 6 |
from authentication.models import AmmicoUser |
| 13 | 7 |
|
8 |
||
9 |
class Book(models.Model): |
|
| 51 | 10 |
user = models.ForeignKey(AmmicoUser, related_name = "books") |
|
71
a5dedc11ba8f
add parent_visit attribute to model to identify a book created by user and a book from Jamespot
rougeronj
parents:
63
diff
changeset
|
11 |
idArticle = models.CharField(max_length=512, null=True) |
| 13 | 12 |
title = models.CharField(max_length=512, blank=True) |
13 |
description = models.CharField(max_length=512, blank=True, null=True) |
|
14 |
image = models.URLField(max_length=2048, blank=True) |
|
| 51 | 15 |
date = models.DateTimeField(default=datetime.datetime.now) |
|
71
a5dedc11ba8f
add parent_visit attribute to model to identify a book created by user and a book from Jamespot
rougeronj
parents:
63
diff
changeset
|
16 |
parent_visit = models.ForeignKey('Book', related_name = "books_copy", null=True) |
| 13 | 17 |
|
|
14
4d27fbc3f9df
Succed to get the books from our api server and print them dynamically
rougeronj
parents:
13
diff
changeset
|
18 |
def __str__(self): |
|
4d27fbc3f9df
Succed to get the books from our api server and print them dynamically
rougeronj
parents:
13
diff
changeset
|
19 |
return self.title |
| 13 | 20 |
|
21 |
class Slide(models.Model): |
|
|
16
f0f0f29395d5
add related_name keyword fro easy access to the slides of a book
rougeronj
parents:
14
diff
changeset
|
22 |
book = models.ForeignKey(Book, related_name = "slides") |
|
45
19f3f0a7fbd7
add idInventory for slides saved from a research and not coming from Jamespot
rougeronj
parents:
21
diff
changeset
|
23 |
idStop = models.CharField(max_length=512, blank=True) |
|
19f3f0a7fbd7
add idInventory for slides saved from a research and not coming from Jamespot
rougeronj
parents:
21
diff
changeset
|
24 |
idInventory = models.CharField(max_length=512, blank=True) |
| 20 | 25 |
title = models.CharField(max_length=512, blank=True) |
26 |
description = models.CharField(max_length=1024, blank=True) |
|
27 |
image = models.URLField(max_length=2048, blank=True) |
|
|
45
19f3f0a7fbd7
add idInventory for slides saved from a research and not coming from Jamespot
rougeronj
parents:
21
diff
changeset
|
28 |
date = models.DateTimeField(default=datetime.datetime.now) |
| 13 | 29 |
favorite = models.BooleanField(default=False, db_index=True) |
|
71
a5dedc11ba8f
add parent_visit attribute to model to identify a book created by user and a book from Jamespot
rougeronj
parents:
63
diff
changeset
|
30 |
tags = TaggableManager() |
| 13 | 31 |
|
|
14
4d27fbc3f9df
Succed to get the books from our api server and print them dynamically
rougeronj
parents:
13
diff
changeset
|
32 |
def __str__(self): |
| 20 | 33 |
return self.idStop |
34 |
||
35 |
class Meta: |
|
36 |
order_with_respect_to = 'book' |