Opened 19 years ago

Closed 18 years ago

Last modified 17 years ago

#480 closed defect (fixed)

Admin interface table detail showing incorrect number of entries

Reported by: tom.haddon@… Owned by: Adrian Holovaty
Component: contrib.admin Version:
Severity: normal Keywords:
Cc: Triage Stage: Unreviewed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

I'd posted a comment on this on the mailing list, but thought I should make a more formal ticket (http://groups.google.com/group/django-users/browse_thread/thread/8bc3ee0eb1b881bf) - please note: one of the issues posted here (being able to sort by the job field) has been resolved by including an ordering value in the model. However, the issue below is still outstanding.

I have a table in my model as follows:


class Schedule(meta.Model):
    id = meta.AutoField(primary_key=True)
    schedule = meta.CharField(maxlength=255, help_text='This takes a
Cron-style format (min hour dom mon dow)')
    job = meta.ForeignKey(Job, db_column='jobid')
    timevariance = meta.IntegerField('Max Duration', default=30,
help_text='The maximum amount of time, in minutes, that you expect the
job to take')
    class META:
        db_table = 'schedule'
        admin = meta.Admin(
            list_display = ('schedule', 'job', 'timevariance'),
        )

For some reason, even though there are 11 records in the database for
this table the admin interface is only showing me one of them.
Underneath that one entry is message text saying "11 schedules", so I
know the DB API is finding them, I just don't know why it's not
displaying them.

Here's a dump of the schedules table:


--
-- PostgreSQL database dump
--

SET client_encoding = 'UNICODE';
SET check_function_bodies = false;

SET SESSION AUTHORIZATION 'postgres';

SET search_path = public, pg_catalog;

--
-- TOC entry 3 (OID 18698)
-- Name: schedule; Type: TABLE; Schema: public; Owner: postgres
--

CREATE TABLE schedule (
    id serial NOT NULL,
    schedule character varying(255),
    jobid integer,
    timevariance integer
);


--
-- Data for TOC entry 6 (OID 18698)
-- Name: schedule; Type: TABLE DATA; Schema: public; Owner: postgres
--

COPY schedule (id, schedule, jobid, timevariance) FROM stdin;
1       30 00 * * *     1       30
2       15 01 * * *     2       30
3       10 17 * * *     2       30
4       00 20 * * *     3       30
6       00 18 * * *     3       15
7       00 19 * * *     3       15
8       30 22 * * *     3       30
9       00 23 * * *     3       20
10      30 12 * * *     1       30
11      00 14 * * *     4       20
12      30 15 * * *     3       30
\.


--
-- TOC entry 5 (OID 18804)
-- Name: schedule_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres
--

ALTER TABLE ONLY schedule
    ADD CONSTRAINT schedule_pkey PRIMARY KEY (id);


--
-- TOC entry 7 (OID 18848)
-- Name: $2; Type: FK CONSTRAINT; Schema: public; Owner: postgres
--

ALTER TABLE ONLY schedule
    ADD CONSTRAINT "$2" FOREIGN KEY (jobid) REFERENCES job(id);


--
-- TOC entry 4 (OID 18696)
-- Name: schedule_id_seq; Type: SEQUENCE SET; Schema: public; Owner: postgres
--

SELECT pg_catalog.setval('schedule_id_seq', 12, true);

Change History (2)

comment:1 by tom.haddon@…, 18 years ago

Here's the Job model as requested from the email.

Thanks, Tom

class Job(meta.Model):
    id = meta.AutoField(primary_key=True)
    jobname = meta.ForeignKey(Jobname, db_column='jobnameid')
    location = meta.ForeignKey(Location, db_column='locationid')
    emailsubject = meta.CharField(maxlength=255)
    notify = meta.ForeignKey(Notify, db_column='notifyid')
    class META:
        db_table = 'job'
        ordering = ['emailsubject']
        admin = meta.Admin(
            list_display = ('id', 'emailsubject'),
            search_fields = ['emailsubject'],
        )

    def __repr__(self):
        return self.emailsubject

comment:2 by Adrian Holovaty, 18 years ago

Resolution: fixed
Status: newclosed

I assume this is fixed by this point.

Note: See TracTickets for help on using tickets.
Back to Top