adding devhub promos and events
This commit is contained in:
Родитель
737c462367
Коммит
2ca9ee4a24
|
@ -51,6 +51,15 @@
|
|||
Tags</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li class="top">
|
||||
<a href="#" class="controller">Dev Hub</a>
|
||||
<ul>
|
||||
<li><a href="{{ url('admin:devhub_hubpromo_changelist') }}">
|
||||
Promos</a></li>
|
||||
<li><a href="{{ url('admin:devhub_hubevent_changelist') }}">
|
||||
Events</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li class="top">
|
||||
<a href="#" class="controller">Server Config</a>
|
||||
</li>
|
||||
|
|
|
@ -0,0 +1,16 @@
|
|||
from django.contrib import admin
|
||||
|
||||
from .models import HubPromo, HubEvent
|
||||
|
||||
|
||||
class HubPromoAdmin(admin.ModelAdmin):
|
||||
list_display = ('heading', 'body', 'visibility')
|
||||
list_editable = ('visibility',)
|
||||
|
||||
|
||||
class HubEventAdmin(admin.ModelAdmin):
|
||||
list_display = ('name', 'url', 'location', 'date')
|
||||
|
||||
|
||||
admin.site.register(HubPromo, HubPromoAdmin)
|
||||
admin.site.register(HubEvent, HubEventAdmin)
|
|
@ -0,0 +1,38 @@
|
|||
from datetime import datetime
|
||||
|
||||
from django.db import models
|
||||
|
||||
import amo
|
||||
from translations.fields import TranslatedField
|
||||
|
||||
|
||||
class HubPromo(amo.ModelBase):
|
||||
VISIBILITY_CHOICES = (
|
||||
(0, 'Nobody'),
|
||||
(1, 'Visitors'),
|
||||
(2, 'Developers'),
|
||||
(3, 'Visitors and Developers'),
|
||||
)
|
||||
|
||||
heading = TranslatedField()
|
||||
body = TranslatedField()
|
||||
visibility = models.SmallIntegerField(choices=VISIBILITY_CHOICES)
|
||||
|
||||
class Meta:
|
||||
db_table = 'hubpromos'
|
||||
|
||||
def __unicode__(self):
|
||||
return unicode(self.heading)
|
||||
|
||||
|
||||
class HubEvent(amo.ModelBase):
|
||||
name = models.CharField(max_length=255, default='')
|
||||
url = models.URLField(max_length=255, default='')
|
||||
location = models.CharField(max_length=255, default='')
|
||||
date = models.DateField(default=datetime.now)
|
||||
|
||||
class Meta:
|
||||
db_table = 'hubevents'
|
||||
|
||||
def __unicode__(self):
|
||||
return self.name
|
|
@ -115,6 +115,7 @@ INSTALLED_APPS = (
|
|||
'admin',
|
||||
'approvals',
|
||||
'applications',
|
||||
'devhub',
|
||||
'editors',
|
||||
'reviews',
|
||||
'tags',
|
||||
|
|
Загрузка…
Ссылка в новой задаче