Commit aa0723c9 by Joel Marpaung

no message

parent 956d23fb
from django.contrib import admin
from farmer.models import *
# Register your models here.
class PenggunaAdmin(admin.ModelAdmin):
list_display = ['username','full_name','phone','email','provinsi','kabupaten','kecamatan','alamat']
list_filter = ('username','full_name','provinsi','kabupaten','kecamatan')
search_fields = ['username','full_name','provinsi','kabupaten','kecamatan']
list_per_page = 25
admin.site.register(Pengguna, PenggunaAdmin)
class AkunAdmin(admin.ModelAdmin):
list_display = ['akun','pengguna','jenis_akun']
list_filter = ('jenis_akun',)
search_fields = []
list_per_page = 25
admin.site.register(Akun, AkunAdmin)
from django.apps import AppConfig
class FarmerConfig(AppConfig):
name = 'farmer'
# -*- coding: utf-8 -*-
# Generated by Django 1.10.5 on 2017-05-10 03:41
from __future__ import unicode_literals
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
initial = True
dependencies = [
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
]
operations = [
migrations.CreateModel(
name='Akun',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('jenis_akun', models.CharField(choices=[('farmer', 'Farmer'), ('admin', 'Admin'), ('surveyer', 'Surveyer'), ('quality', 'Quality')], max_length=20)),
('akun', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL)),
],
),
migrations.CreateModel(
name='Pengguna',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('username', models.CharField(blank=True, max_length=200)),
('full_name', models.CharField(blank=True, max_length=200)),
('phone', models.CharField(blank=True, max_length=30)),
('email', models.CharField(blank=True, max_length=200)),
('provinsi', models.CharField(blank=True, max_length=100)),
('kabupaten', models.CharField(blank=True, max_length=100)),
('kecamatan', models.CharField(blank=True, max_length=100)),
('alamat', models.CharField(blank=True, max_length=250)),
],
),
migrations.AddField(
model_name='akun',
name='pengguna',
field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='farmer.Pengguna'),
),
]
# -*- coding: utf-8 -*-
# Generated by Django 1.10.5 on 2017-05-10 04:23
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('farmer', '0001_initial'),
]
operations = [
migrations.AlterField(
model_name='pengguna',
name='alamat',
field=models.CharField(max_length=250, null=True),
),
migrations.AlterField(
model_name='pengguna',
name='email',
field=models.CharField(max_length=200, null=True),
),
migrations.AlterField(
model_name='pengguna',
name='full_name',
field=models.CharField(max_length=200, null=True),
),
migrations.AlterField(
model_name='pengguna',
name='kabupaten',
field=models.CharField(max_length=100, null=True),
),
migrations.AlterField(
model_name='pengguna',
name='kecamatan',
field=models.CharField(max_length=100, null=True),
),
migrations.AlterField(
model_name='pengguna',
name='phone',
field=models.CharField(max_length=30, null=True),
),
migrations.AlterField(
model_name='pengguna',
name='provinsi',
field=models.CharField(max_length=100, null=True),
),
migrations.AlterField(
model_name='pengguna',
name='username',
field=models.CharField(max_length=200, null=True),
),
]
from __future__ import unicode_literals
from django.db import models
from django.contrib.auth.models import User
# Create your models here.
class Pengguna (models.Model):
username = models.CharField(max_length=200, null=True)
full_name = models.CharField(max_length=200, null=True)
phone = models.CharField(max_length=30, null=True)
email = models.CharField(max_length=200, null=True)
provinsi = models.CharField(max_length=100, null=True)
kabupaten = models.CharField(max_length=100, null=True)
kecamatan = models.CharField(max_length=100, null=True)
alamat = models.CharField(max_length=250, null=True)
def __str__(self):
return self.full_name
class Akun (models.Model):
JENIS_AKUN_CHOICES = (
('farmer', 'Farmer'),
('admin', 'Admin'),
('surveyer', 'Surveyer'),
('quality', 'Quality'),
)
akun = models.ForeignKey(User)
pengguna = models.ForeignKey(Pengguna)
jenis_akun = models.CharField(max_length=20, choices=JENIS_AKUN_CHOICES)
def __str__(self):
return self.pengguna.full_name
\ No newline at end of file
from django.test import TestCase
# Create your tests here.
from django.shortcuts import render
# Create your views here.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment