Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #urls.py
- urlpatterns = patterns('',
- # Example:
- # (r'^camperone/', include('camperone.foo.urls')),
- # Uncomment the admin/doc line below and add 'django.contrib.admindocs'
- # to INSTALLED_APPS to enable admin documentation:
- (r'^admin/doc/', include('django.contrib.admindocs.urls')),
- # Uncomment the next line to enable the admin:
- (r'^admin/', include(admin.site.urls)),
- (r'^', include('cms.urls')),
- (r'^grappelli/', include('grappelli.urls')),
- (r'^usato/(\d+)/', "camper.views.usato"),
- # (r'^admin/form_designer/', include('form_designer.admin_urls')),
- # (r'^forms/', include('form_designer.urls')),
- )
- #models.py
- class Usato(models.Model):
- modello = models.ForeignKey(Modelli)
- km_percorsi = models.IntegerField()
- accessori = models.ManyToManyField(Accessori)
- anno_immatricolaz = models.IntegerField()
- note = models.TextField(max_length=500)
- prezzo = models.FloatField()
- def __unicode__(self):
- return u"%s" % (self.modello)
- def get_menu_title(self):
- return self.name
- def get_absolute_url(self):
- return reverse('usato', args=[self.pk])
- class Meta:
- verbose_name = "Camper Usato"
- verbose_name_plural = "Camper Usati"
- #utils.py
- from camper.models import Usato
- def get_usati(request):
- usati = list(Usato.objects.all())
- res = []
- for usato in usati:
- res.append(usato)
- return res
- #settings.py
- CMS_NAVIGATION_EXTENDERS = (
- # ('cmsplugin_news.navigation.get_nodes','News navigation'),
- ('camper.utils.get_usati','Camper usati'),
- )
Add Comment
Please, Sign In to add comment