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
import boto3 | |
from datetime import datetime as dt | |
import os | |
from tqdm import tqdm | |
import json | |
import datetime | |
def datetime_handler(x): | |
if isinstance(x, dt): |
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
from django.apps.registry import Apps | |
app_config = apps.get_app_config('<app_name>') | |
# To create Content Types | |
from django.contrib.contenttypes.management import create_contenttypes | |
create_contenttypes(app_config) | |
# To create Permissions | |
from django.contrib.auth.management import create_permissions |
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
{{ object.name }} | |
{{ object.owner }} |
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
class CompanyIndex(indexes.SearchIndex, indexes.Indexable): | |
text = indexes.CharField(document=True, use_template=True) | |
name = indexes.CharField(model_attr='name') | |
owner = indexes.CharField() | |
def get_model(self): | |
return Company | |
def index_queryset(self, using=None): | |
"""Used when the entire index for model is updated.""" |
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
from django.core.management.base import BaseCommand | |
from django.conf import settings | |
from storages.backends.s3boto import S3BotoStorage | |
from boto.s3.connection import S3Connection | |
from boto.s3.key import Key | |
import os | |
from hashlib import md5 | |
from subprocess import call | |
# Assuming the project structure is like this: |