View scene_number.py
# image create view
if form.is_valid():
images = Image.objects.order_by('-_id').all()
if len(images)>0:
# get latest image scene number
scene_number = Images.first().scene_number + 1
else:
# creating first image so set scene_number =1
scene_number = 1
View image_edit.js
# add this js file /static/js/image_edit.js
$(document).ready(function(){
var width = window.innerWidth;
var height = window.innerHeight;
function update(activeAnchor) {
var group = activeAnchor.getParent();
var topLeft = group.get('.topLeft')[0];
View template.html
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
</head>
<body>
<h1>Images</h1>
<table>
{% for image in object_list %}
<tr>
View fileupload.py
# convert image and video fields to StringField() in models.py
# remove type field from models.py and forms.py as well
# view.py changes
# create_image view
image = form.save()
image_file = request.FILES['image']
View company_profile.json
{
"id": 1,
"name": "Meri Company",
"street": "",
"city": "",
"state": "",
"country": "",
"lat": "0.00000000000000000000",
"lng": "0.00000000000000000000",
"site_url": "",
View abc.py
user/models.py
from mongoengine import EmbeddedDocument, Document, CASCADE
from mongoengine import fields
import binascii
import os
from django.utils import timezone
View new.py
views.py
from rest_framework_mongoengine import generics
from rest_framework.response import Response
from .serializers import LoginSerializer
from configuration.models import User
#from captive_portal.models import SessionHistory, Voucher
from .models import SessionHistory
from rest_framework import serializers
View serializer.py
class SessionHistoryCreateSerializer(DocumentSerializer):
class Meta:
model = SessionHistory
fields = '__all__'
# check date...
def validate(self, data):
data = super().validate(data)
View serializer.py
class SocialLoginSerializer(UserDeviceMixin, serializers.Serializer):
PROVIDER_CHOICES = Provider.objects.values_list('name')
# first_name = serializers.CharField(required=False, allow_blank=True)
# last_name = serializers.CharField(required=False, allow_blank=True)
# email = serializers.EmailField()
# mac_address = serializers.CharField()
name = serializers.CharField(required=False, allow_blank=True)
View fields.xml
field names
<fields>
<first_name>
<type>string</type>
<max_length>50</max_length>
</first_name>
<last_name>
<type>string</type>