Changeset 9747 for src


Ignore:
Timestamp:
Dec 3, 2011, 11:01:20 AM (13 years ago)
Author:
rick
Message:

is_imported is a machine changed fields. Do not allow users to edit the file.

Location:
src/django_gheat/gheat
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • src/django_gheat/gheat/admin.py

    r9637 r9747  
    1010class MeetBestandInline(admin.TabularInline):
    1111  model = MeetBestand
     12  readonly_fields = ['is_imported']
     13
    1214class MeetRondjeAdmin(admin.ModelAdmin):
    1315  inlines = [ MeetBestandInline, ]
     
    2527
    2628class MeetBestandAdmin(admin.ModelAdmin):
    27    list_display = ['meetrondje', 'bestand', 'is_imported']
     29  list_display = ['meetrondje', 'bestand', 'filetype', 'is_imported']
     30  readonly_fields = ['is_imported']
    2831admin.site.register(MeetBestand, MeetBestandAdmin)
    2932
  • src/django_gheat/gheat/models.py

    r9664 r9747  
    108108    verbose_name_plural = 'MeetRondjes'
    109109
     110FILE_TYPES = (
     111 ( 'netxml', 'Netstumbler NetXML'),
     112 ( 'gpsxml', 'Netstumbler GPSXML'),
     113 ( 'droidcsv', 'DroidStumbler CSV'),
     114)
     115
    110116class MeetBestand(models.Model):
    111117  meetrondje = models.ForeignKey(MeetRondje)
    112118  bestand = models.FileField(upload_to='scan-data/%Y/%m/%d')
    113   is_imported = models.BooleanField(default=False)
     119  filetype = models.CharField(max_length=64,choices=FILE_TYPES,default='netxml')
     120  is_imported = models.BooleanField(default=False,help_text="This field get set the moment the data is processed into the database")
    114121  class Meta:
    115122    verbose_name_plural = 'MeetBestanden'
Note: See TracChangeset for help on using the changeset viewer.