messy wip for Note
parent
31adb3cc3a
commit
dfd843064d
|
@ -1,5 +1,13 @@
|
||||||
from django.contrib import admin
|
from django.contrib import admin
|
||||||
from .models import Ticket
|
from django.forms import ModelForm
|
||||||
|
from .models import Ticket, Note
|
||||||
|
|
||||||
|
class NoteInline(admin.StackedInline):
|
||||||
|
model = Note
|
||||||
|
fields = ('created_at', 'body', 'author')
|
||||||
|
readonly_fields = ('created_at', 'body', 'author')
|
||||||
|
ordering = ('created_at',)
|
||||||
|
extra = 1
|
||||||
|
|
||||||
@admin.register(Ticket)
|
@admin.register(Ticket)
|
||||||
class TicketAdmin(admin.ModelAdmin):
|
class TicketAdmin(admin.ModelAdmin):
|
||||||
|
@ -7,3 +15,9 @@ class TicketAdmin(admin.ModelAdmin):
|
||||||
list_display = ('submitted', 'issue_status', 'issue_type', 'name', 'email')
|
list_display = ('submitted', 'issue_status', 'issue_type', 'name', 'email')
|
||||||
list_filter = ('issue_status', 'issue_type')
|
list_filter = ('issue_status', 'issue_type')
|
||||||
fields = ('submitted', 'name', 'email', 'issue_status', 'issue_type', 'issue_text')
|
fields = ('submitted', 'name', 'email', 'issue_status', 'issue_type', 'issue_text')
|
||||||
|
|
||||||
|
def save_related(request, form, formsets, change):
|
||||||
|
for formset in formsets:
|
||||||
|
import ipdb; ipdb.set_trace()
|
||||||
|
pass # TODO set author based on request
|
||||||
|
super()
|
||||||
|
|
|
@ -0,0 +1,27 @@
|
||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
# Generated by Django 1.10.2 on 2019-07-16 02:43
|
||||||
|
from __future__ import unicode_literals
|
||||||
|
|
||||||
|
from django.db import migrations, models
|
||||||
|
import django.db.models.deletion
|
||||||
|
|
||||||
|
|
||||||
|
class Migration(migrations.Migration):
|
||||||
|
|
||||||
|
dependencies = [
|
||||||
|
('users', '0015_remove_townie_reviewed'),
|
||||||
|
('help', '0004_ticket_submitted'),
|
||||||
|
]
|
||||||
|
|
||||||
|
operations = [
|
||||||
|
migrations.CreateModel(
|
||||||
|
name='Note',
|
||||||
|
fields=[
|
||||||
|
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
|
||||||
|
('created', models.DateTimeField(auto_now_add=True)),
|
||||||
|
('body', models.TextField()),
|
||||||
|
('author', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='users.Townie')),
|
||||||
|
('ticket', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='help.Ticket')),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
]
|
|
@ -1,4 +1,4 @@
|
||||||
from django.db.models import Model, TextField, EmailField, CharField, DateTimeField
|
from django.db.models import Model, TextField, EmailField, CharField, DateTimeField, ForeignKey
|
||||||
|
|
||||||
ISSUE_TYPE_CHOICES = (
|
ISSUE_TYPE_CHOICES = (
|
||||||
('logging_in', 'help logging in'),
|
('logging_in', 'help logging in'),
|
||||||
|
@ -34,3 +34,10 @@ class Ticket(Model):
|
||||||
|
|
||||||
def __str__(self):
|
def __str__(self):
|
||||||
return '{} from {}'.format(self.issue_type, self.name)
|
return '{} from {}'.format(self.issue_type, self.name)
|
||||||
|
|
||||||
|
|
||||||
|
class Note(Model):
|
||||||
|
created = DateTimeField(auto_now_add=True)
|
||||||
|
body = TextField(blank=False, null=False)
|
||||||
|
author = ForeignKey('users.Townie')
|
||||||
|
ticket = ForeignKey(Ticket)
|
||||||
|
|
Loading…
Reference in New Issue