This document has now been incorporated into the uWSGI documentation:
http://uwsgi-docs.readthedocs.org/en/latest/tutorials/Django_and_nginx.html
Steps with explanations to set up a server using:
# simple snippet data to grouping and counting a django models | |
# for example in this data | |
# I have fields with attribute DateTimeField | |
# so I use `Model.objects.datetimes` | |
# Because I just want get day,month,year | |
# If you just use fields `DateTime` Prefer you can use `Model.objects.date` | |
users = Model.objects.all() # Models to be grouping | |
count_user = [{'val': users.filter(date_joined__day=x.day,date_joined__month=x.month,date_joined__year=x.year).count(), 'date':x.strftime('%Y-%m-%d')} for x in Model.objects.datetimes('date_joined','day')] |
#!/usr/bin/env python | |
# Install fake factory at first. Helps us create 50k customers in odoo | |
# pip install fake-factory | |
# Documentation for odoo is listed here | |
# https://www.odoo.com/documentation/9.0/api_integration.html#calling-methods | |
# MIT License | |
# Copyright (c) 2016 Jasim Muhammed |
cr = self.env.cr | |
sql = 'select product_id, location_id, sum(qty) from stock_quant where location_id != 9 group by location_id, product_id order by product_id asc limit 10' | |
cr.execute(sql) | |
cr.dictfetchall() | |
""" | |
Example Output: | |
[{'sum': 4.0, 'location_id': 19, 'product_id': 13}, {'sum': 1.0, 'location_id': 12, 'product_id': 13}, {'sum': 20.0, 'location_id': 19, 'product_id': 14}, {'sum': 2.0, 'location_id': 12, 'product_id': 14}, {'sum': 3.0, 'location_id': 19, 'product_id': 15}, {'sum': 3.0, 'location_id': 12, 'product_id': 16}, {'sum': 6.0, 'location_id': 19, 'product_id': 16}, {'sum': 28.0, 'location_id': 19, 'product_id': 17}, {'sum': 3.0, 'location_id': 19, 'product_id': 18}, {'sum': 6.0, 'location_id': 12, 'product_id': 18}] |
# app/views.py | |
from django.contrib.auth import authenticate, login | |
from django.http import HttpResponse | |
from django.views.decorators.csrf import csrf_exempt | |
@csrf_exempt | |
def login_user(request): | |
user = authenticate(username=request.POST['username'], password=request.POST['password']) | |
login(request, user) | |
return HttpResponse("Logged In") |
External ID;Code;Name;Allow Reconciliation;Type/ID | |
__export__.account_account_176;1.01.01.01;Kas Belum Disetor Cabang Bandung;True;3 | |
__export__.account_account_177;1.01.01.02;Kas Kecil Cabang Bandung;True;3 | |
__export__.account_account_174;1.01.04.01;Piutang Usaha Cabang Bandung;True;1 | |
__export__.account_account_175;2.01.01.01;Hutang Usaha Cabang Bandung;True;2 | |
;1.01.01.02;Kas Belum Disetor Cabang Bali;True;3 | |
;1.01.01.03;Kas Kecil Cabang Bali;True;3 | |
;1.01.04.02;Piutang Usaha Cabang Bali;True;1 | |
;2.01.01.02;Hutang Usaha Cabang Bali;True;2 | |
;1.01.01.03;Kas Belum Disetor Cabang Bekasi;True;3 |
#!/usr/bin/env python | |
# -*- encoding: utf-8 -*- | |
"""Uninstall a module""" | |
import xmlrpclib | |
import argparse | |
import getpass | |
parser = argparse.ArgumentParser() | |
# Connection args |
from odoo import models, fields, api, _ | |
class SiteSurvey(models.Model): | |
_inherit = "site.survey" | |
cancel_reason = fields.Char("cancel reason") | |
class SiteSurveyWizard(models.TransientModel): | |
_name = "site.survey.wizard" |
I hereby claim:
To claim this, I am signing this object: