Hi

I am building my first Django site which has a lot of effectively 'static' 
pages where I just want to make the meta data and text editable.

The model is

models.py

class About(models.Model):
    page_title = models.CharField(max_length=900, help_text='Text at top of 
browser window')
    meta_keywords = models.CharField(max_length=900, help_text='Keywords (for 
SEO)')
    meta_description = models.CharField(max_length=160, help_text='Description 
(for SEO)')
    logo_header = models.CharField(max_length=900, help_text='H1 Header (for 
SEO)')
    header = models.CharField(max_length=60)
    body = models.TextField()
    last_updated = models.DateTimeField(default=datetime.datetime.now, 
primary_key=True)
    
    class Meta:
        get_latest_by = "last_updated"
        verbose_name_plural = "About Page"
#        managed = False
    
def __unicode__(self):
    return self.title


I'm trying to understand how to either write a model that only allows a single 
entry or write a view that will take either a single entry or the most recent 
entry.

views.py

def about(request):
        return render_to_response('about.html',
                                                                { 'About' : 
About.objects.latest() })
urls.py

    (r'^about/$', 'harkproject.cms.views.about'),

Much appreciated
Al Macmillan



_______________________________________________
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor

Reply via email to