usethesource: Add admin interface
This commit is contained in:
		
							parent
							
								
									b39fbaa402
								
							
						
					
					
						commit
						54ae2c7b06
					
				
					 3 changed files with 30 additions and 1 deletions
				
			
		|  | @ -1,7 +1,7 @@ | |||
| from django.contrib import admin | ||||
| 
 | ||||
| from .emails import make_candidate_email | ||||
| from .models import Candidate, Comment | ||||
| from .models import Candidate, Comment, SourceOffer | ||||
| 
 | ||||
| 
 | ||||
| class CommentInline(admin.TabularInline): | ||||
|  | @ -36,3 +36,10 @@ class CandidateAdmin(admin.ModelAdmin): | |||
|             # Announce the new candidate | ||||
|             email = make_candidate_email(obj, request.user) | ||||
|             email.send() | ||||
| 
 | ||||
| 
 | ||||
| @admin.register(SourceOffer) | ||||
| class SourceOfferAdmin(admin.ModelAdmin): | ||||
|     list_display = ['time', 'vendor', 'device'] | ||||
|     fields = ['time', 'vendor', 'device', 'photo'] | ||||
|     readonly_fields = ['time'] | ||||
|  |  | |||
							
								
								
									
										18
									
								
								conservancy/usethesource/migrations/0010_sourceoffer_time.py
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										18
									
								
								conservancy/usethesource/migrations/0010_sourceoffer_time.py
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,18 @@ | |||
| # Generated by Django 4.2.11 on 2024-07-29 09:42 | ||||
| 
 | ||||
| from django.db import migrations, models | ||||
| 
 | ||||
| 
 | ||||
| class Migration(migrations.Migration): | ||||
| 
 | ||||
|     dependencies = [ | ||||
|         ('usethesource', '0009_sourceoffer'), | ||||
|     ] | ||||
| 
 | ||||
|     operations = [ | ||||
|         migrations.AddField( | ||||
|             model_name='sourceoffer', | ||||
|             name='time', | ||||
|             field=models.DateTimeField(auto_now_add=True, null=True), | ||||
|         ), | ||||
|     ] | ||||
|  | @ -70,6 +70,10 @@ class Comment(models.Model): | |||
| 
 | ||||
| 
 | ||||
| class SourceOffer(models.Model): | ||||
|     time = models.DateTimeField(auto_now_add=True, null=True) | ||||
|     vendor = models.CharField('Vendor name', max_length=50) | ||||
|     device = models.CharField('Device name', max_length=50) | ||||
|     photo = models.ImageField(upload_to='usethesource/offers') | ||||
| 
 | ||||
|     def __str__(self): | ||||
|         return f'{self.vendor} {self.device}' | ||||
|  |  | |||
		Loading…
	
	Add table
		
		Reference in a new issue