class HTTPDetails(models.Model): # request or response http_type = models.CharField(max_length=10) # request fields method = models.CharField(max_length=5, null=True, blank=True) uri = models.URLField(null=True, blank=True) headers = models.TextField(null=True, blank=True) version = models.FloatField(null=True, blank=True) # request part ends # response fields # header and version is here also reason = models.CharField(max_length="5", null=True, blank=True) status = models.IntegerField(null=True, blank=True) # i might need body body = models.TextField(null=True, blank=True) content_type = models.CharField(max_length=25, null=True, blank=True) content_encoding = models.CharField(max_length=25, null=True, blank=True) # response ends # i might need files also files = ListField(null=True, blank=True) file_path = models.CharField(max_length=200, null=True, blank=True) flow_details = EmbeddedModelField('FlowDetails', null=True, blank=True) #for raw_qeuries, filtering according to flow_details will be possible objects = MongoDBManager()
class OutgoingMessage(models.Model): objects = MongoDBManager() primary_id = models.IntegerField(primary_key=True) phone = models.TextField() message = models.TextField() message_type = models.TextField() created_at = models.DateTimeField()
class Interaction(Model): """ Any interaction done by a Staff on either an Order or an IncompleteClient. This allows to monitor how those have been addressed. """ CALL = 'Call' TEXT = 'Text' EMAIL = 'Email' INTERVENTION = 'Intervention' INTERACTION_TYPES = ( (CALL, _('Call')), (TEXT, _('Text / WhatsApp')), (EMAIL, _('Email')), (INTERVENTION, _('Intervention')) ) member = models.ForeignKey(Member) object_id = models.CharField(max_length=24, db_index=True) # ID of Order or IncompleteClient type = models.CharField(max_length=100, choices=INTERACTION_TYPES, db_index=True) summary = models.TextField(blank=True, null=True) response = models.TextField() next_rdv = models.DateTimeField(blank=True, null=True) viewed_by = ListField() # List of sudo who already checked this interaction objects = MongoDBManager() def to_dict(self): val = to_dict(self) val['member'] = self.member.full_name return val
class DNSResponse(models.Model): type = models.IntegerField() human_readable_type = models.CharField(max_length=50) value = ListField(null=True, blank=True) flow_details = EmbeddedModelField('FlowDetails', null=True, blank=True) objects = MongoDBManager()
class Transaction(models.Model): id = models.IntegerField(primary_key=True, editable=True) name = models.CharField(max_length=100) bill = models.IntegerField() datetime = models.DateTimeField(auto_now_add=True) objects = MongoDBManager()
class Court(models.Model): id = models.CharField(primary_key=True, default=uuid.uuid4(), max_length=50, editable=True, unique=True) name = models.CharField(max_length=100, blank=False) description = models.CharField(max_length=100, blank=True) # Address Information house_number = models.CharField(max_length=10, blank=True) road = models.CharField(max_length=100, blank=False) city = models.CharField(max_length=30, blank=False) state = models.CharField(max_length=30, blank=False) zip_code = models.CharField(max_length=10, blank=False) county = models.CharField(max_length=30, blank=True) country = models.CharField(max_length=20, blank=False) # Rating Information likes = models.IntegerField(default=0) dislikes = models.IntegerField(default=0) court_logo = models.ImageField(max_length=1000, blank=True) location = models.EmbeddedModelField(Point) objects = MongoDBManager() def __str__(self): return self.name + " " + self.description
class Report(models.Model): """task = models.ForeignKey( Task, related_name='task_reports', primary_key=True, on_delete=models.DO_NOTHING) patient = models.ForeignKey( Profile, related_name='patient_reports', on_delete=models.DO_NOTHING)""" task = models.IntegerField(null=False) patient = models.IntegerField(null=False) date = models.DateTimeField(_(u'Fecha del Informe'), null=True) sex = models.IntegerField(null=True) blocks = ListField() education = models.IntegerField(null=True) marital = models.IntegerField(null=True) profession = models.CharField(max_length=150) age = models.IntegerField(null=True) illnesses = ListField() treatment = ListField() variables = DictField() aves = ListField() dimensions = DictField() status = DictField() objects = MongoDBManager() class Meta: db_table = 'reports' managed = False
class Post(models.Model): created_on = models.DateTimeField(auto_now_add=True, null=True) title = models.CharField(max_length=100) text = models.TextField() tags = ListField() comments = ListField(EmbeddedModelField('Comment')) # <--- objects = MongoDBManager()
class NeuroToxin(models.Model): sourceid = models.CharField(max_length=30) text = models.TextField() sourcedb = models.CharField(max_length=200) denotations = ListField() objtype = ListField() objects = MongoDBManager()
class MedLine(models.Model): Title = models.CharField(max_length=200) URL = models.CharField(max_length=50) Description = models.CharField(max_length=200) ShortDetails = models.CharField(max_length=200) EntrezUID = models.CharField(max_length=30) objtype = ListField() objects = MongoDBManager()
class TestArticle(models.Model): objects = MongoDBManager() main_category = models.ForeignKey(TestCategory, related_name='main_articles') categories = MongoDBManyToManyField(TestCategory) tags = MongoDBManyToManyField(TestTag, related_name='articles', embed=True) title = models.CharField(max_length=254) text = models.TextField() def __unicode__(self): return self.title
class PE_Sub(models.Model): name = models.TextField() language = models.TextField() filetype = models.TextField() sublanguage = models.TextField() offset = models.TextField() md5 = models.TextField() size = models.TextField() objects = MongoDBManager() fs_id = models.TextField()
class Text(models.Model): objects = MongoDBManager() textId = models.CharField(max_length=255) authors = ListField(EmbeddedModelField('Person')) class MongoMeta: indexes = [[('textId', 1)]]
class Venue(models.Model): _id = models.CharField(max_length=255, unique=True) name = models.CharField(null=True, blank=True, max_length=255) contact = DictField() location = DictField() # location = EmbeddedModelField(Location) categories = ListField() verified = models.BooleanField() date = models.DateTimeField(auto_now_add=True) objects = MongoDBManager()
class FlowDetails(models.Model): parent_hash_value = models.CharField(max_length=50) user_id = models.CharField(max_length=100) src_ip = models.IPAddressField() dst_ip = models.IPAddressField() sport = models.IntegerField() dport = models.IntegerField() protocol = models.CharField(max_length=10) timestamp = models.DateTimeField() objects = MongoDBManager()
class Timeline(models.Model): title = models.CharField(max_length=256, blank=True, default='') author = models.CharField(max_length=256, blank=True, default='') wiki = models.TextField(default='') project_id = models.IntegerField(blank=False, null=False) #current_version = models.IntegerField() #date= models.DateTimeField(auto_now=True) date = models.DateTimeField() history = ListField(EmbeddedModelField('History')) objects = MongoDBManager()
class Disease(models.Model): patient = models.ForeignKey('Registration') symptom = models.CharField(_('Disease Symptom'), max_length=50) doctor = models.CharField(_('Doctor Consulted'), max_length=50) prescription = models.CharField(_('Prescription'), max_length=50) report = models.FileField(_('Report Attachment'), upload_to=get_upload_file_path) disease = models.CharField(_('Detected Disease'), max_length=50) cured = models.BooleanField() objects = MongoDBManager() def __unicode__(self): return self.disease
class TeacherResponsibility(Model): teacher = models.ForeignKey(Teacher) subject = models.ForeignKey(Subject) classroom_fk_list = ListField() objects = MongoDBManager() class Meta: unique_together = ( 'teacher', 'subject', )
class Employee(models.Model): usr = models.OneToOneField(User) address = models.CharField(max_length=100) gender = models.CharField(max_length=100) dob = models.DateField(null=True, blank=True) qualification = ListField() dept = EmbeddedModelField(Department) mobile_no = models.CharField(max_length=100) date_of_join = models.DateField(null=True, blank=True, auto_now_add=True) objects = MongoDBManager()
class City(models.Model): class Translation(translation.Translation): name = models.CharField(max_length=64) country = fields.EmbeddedModelField(Country, null=True) state = fields.EmbeddedModelField('State', null=True) population = models.PositiveIntegerField(null=True) geo = fields.ListField(models.FloatField(), null=True) objects = MongoDBManager() def __unicode__(self): return unicode(self.name)
class LeaveRequest(models.Model): emp = models.OneToOneField(Employee) dept = models.OneToOneField(Department) leave_from = models.DateField(null=True, blank=True) leave_to = models.DateField(null=True, blank=True) no_of_days = models.IntegerField() ltype = models.OneToOneField(LeaveType) avail_leave = models.IntegerField(default=12) total_leave = models.IntegerField(default=12) reason = models.CharField(max_length=200) status = models.CharField(max_length=200, default='Requested') objects = MongoDBManager()
class Annotation(models.Model): jsonld_context = ListField( models.CharField( max_length = 4096 ) ) # ["http://www.w3.org/ns/anno.jsonld"] # 20160706, [email protected] # Should allow list of which link string would be one item, however needs # to be string when alone. How compatibility of Django data model # declaration with specification can be obtained is unclear at this point. jsonld_id = models.CharField( max_length = 4096 ) type = ListField( models.CharField( max_length = 256 ) ) # (rdf:type) oa:Annotation and others body = ListField( EmbeddedModelField(), null=True ) # CharField( max_length = 4096, null = True ) target = ListField( EmbeddedModelField() ) # models.CharField( max_length = 4096 ) creator = ListField( EmbeddedModelField("Agent"), null=True ) # dcterms:creator created = models.DateTimeField( auto_now_add=True, null=True ) # dcterms:created MUST xsd:dateTime with the UTC timezone expressed as "Z". generator = ListField( EmbeddedModelField("Agent"), null=True ) # prov:wasGeneratedBy generated = models.DateTimeField( auto_now=True, null=True ) # prov:generatedAtTime MUST xsd:dateTime with the UTC timezone expressed as "Z". modified = models.DateTimeField( null=True ) # MUST xsd:dateTime with the UTC timezone expressed as "Z". #modified = models.DateTimeField( auto_now=True, null=True ) # MUST xsd:dateTime with the UTC timezone expressed as "Z". #audience = ListField( EmbeddedModelField("Audience"), null=True ) #rights = ListField( models.CharField( max_length = 4096 ), null=True ) # MAY be then MUST be an IRI #canonical = models.CharField( max_length = 4096, null=True ) # IRI #via = ListField( models.CharField( max_length = 4096, null=True ) ) # IRIs ASSESSING = "assessing" BOOKMARKING = "bookmarking" CLASSIFYING = "classifying" COMMENTING = "commenting" DESCRIBING = "describing" EDITING = "editing" HIGHLIGHTING = "highlighting" IDENTIFYING = "identifying" LINKING = "linking" MODERATING = "moderating" QUESTIONING = "questioning" REPLYING = "replying" TAGGING = "tagging" MOTIVATION_CHOICES = ( (ASSESSING, "assessing"), # oa:assessing (BOOKMARKING, "bookmarking"), # oa:bookmarking (CLASSIFYING, "classifying"), # oa:classifying (COMMENTING, "commenting"), # oa:commenting (DESCRIBING, "describing"), # oa:describing (EDITING, "editing"), # oa:editing (HIGHLIGHTING, "highlighting"), # oa:highlighting (IDENTIFYING, "identifying"), # oa:identifying (LINKING, "linking"), # oa:linking (MODERATING, "moderating"), # oa:moderating (QUESTIONING, "questioning"), # oa:questioning (REPLYING, "replying"), # oa:replying (TAGGING, "tagging"), # oa:tagging ) motivation = ListField( models.CharField( max_length = 256, choices=MOTIVATION_CHOICES ), null=True ) # oa:motivatedBy = [oa:Motivation] #stylesheet = EmbeddedModelField( "CssStyleSheet", null=True ) #oa:styledBy objects = MongoDBManager() # http://stackoverflow.com/questions/23546480/no-raw-query-method-in-my-django-object
class Place(models.Model): parent_pk = models.IntegerField(_('Parent Message PK'), blank=True, null=True) summary = models.ForeignKey('Location', blank=True, null=True) object_pk = models.CharField(_('object ID'), max_length=100) content_object = generic.GenericForeignKey(ct_field="content_type", fk_field="object_pk") content_type = models.ForeignKey(ContentType, verbose_name=_('content type'), related_name="content_type_set_for_%(class)s") location = EmbeddedModelField(Point) objects = MongoDBManager() def __unicode__(self): return str(self.summary.description)
class TestOldArticle(models.Model): class Meta: # Used for testing migrations using same MongoDB collection db_table = 'mongom2m_testapp_testarticle' objects = MongoDBManager() main_category = models.ForeignKey(TestCategory, related_name='main_oldarticles') categories = ListField(models.ForeignKey(TestCategory)) tags = ListField(models.ForeignKey(TestTag)) title = models.CharField(max_length=254) text = models.TextField() def __unicode__(self): return self.title
class Person(models.Model): objects = MongoDBManager() name = models.CharField(max_length=255) texts = ListField(EmbeddedModelField('TextSet')) ids = ListField(EmbeddedModelField('Id')) nameVariants = ListField() deepestPaths = ListField(EmbeddedModelField('Path')) # deepestPaths = ListField(DictField()) class MongoMeta: indexes = [[('name', 1)]]
class News(models.Model): title = models.CharField(max_length=255) link = models.URLField() content = models.TextField() created = models.DateTimeField(null=True, blank=True) tags = models.CharField(max_length=255, null=True, blank=True) scraped_date = models.DateTimeField(auto_now_add=True) objects = MongoDBManager() class Meta: db_table = 'news_news' ordering = ['-created'] def save(self, *args, **kwargs): super(News, self).save(using=settings.DB_NONREL)
class Analysis(models.Model): name = models.TextField() md5 = models.TextField() sha1 = models.TextField() sha256 = models.TextField() sha512 = models.TextField() ssdeep = models.TextField() crc = models.TextField() file_type = models.TextField() analysis_date = models.DateField() fs_id = models.TextField() meta = EmbeddedModelField('Meta') modules = ListField(EmbeddedModelField()) objects = MongoDBManager() class MongoMeta: db_table="analysis"
class Profile(models.Model): display_name = models.CharField(max_length=50, blank=False) #Past modification_date = models.DateTimeField(null=True) avatar = models.ImageField(upload_to='avatars/', null=False) location = models.CharField(max_length=50, blank=False) user = models.ForeignKey(User, related_name="profile", unique=True) following = ListField(EmbeddedModelField('Following')) karma = models.IntegerField(default=6) username = models.CharField(max_length=50, blank=False) objects = MongoDBManager() def __str__(self): return str(self.display_name) def get_experiences(self): return Experience.objects.filter(author=self.user)
class Registration(models.Model): DOCTOR_CHOICE = ( ('mohsin', 'Mohsin'), ('sheesh', 'Sheesh'), ) first_name = models.CharField(max_length=20) last_name = models.CharField(max_length=20) age = models.CharField(max_length=3) mobile = models.CharField(max_length=12) date = models.DateField(default=datetime.date.today()) doctor = models.ForeignKey('Doctor') picture = models.ImageField(_('Patient Image'), upload_to=get_upload_file_path) #doctor = models.CharField(choices=DOCTOR_CHOICE, max_length=25) objects = MongoDBManager() def __unicode__(self): return self.first_name
class PacketDetails(models.Model): #datetime.datetime.fromtimestamp(float("1286715787.71")).strftime('%Y-%m-%d %H:%M:%S') ident = models.IntegerField() flow_hash = models.CharField(max_length=50) timestamp = models.DateTimeField() length = models.IntegerField() protocol = models.IntegerField() src_ip = models.IPAddressField() dst_ip = models.IPAddressField() sport = models.IntegerField() dport = models.IntegerField() data = models.TextField(null=True, blank=True) def __unicode__(self): return u'(%s, %s, %s, %s, %s)' % (self.protocol, self.src_ip, self.sport, self.dst_ip, self.dport) objects = MongoDBManager()