I
I
Ivan Gorokhov2014-01-25 18:16:39
Django
Ivan Gorokhov, 2014-01-25 18:16:39

How to adapt a Django application to Django 1.6?

The question is, I started to study python + django 1.6
. I study using the example of creating a personal portfolio blog.
The question arose about the portfolio component itself, I found it on the net and forked this application to my github _ https://github.com/powellc/django-portfolio
But it was written a very long time ago and of course it throws errors.
I'll start in order, at first I swore at this:

from django.views.generic import date_based, list_detail

I found a kind of solution that you need to change the import to this: Then I started to swear at:
from django.views.generic.list import ListView
from tagging.fields import TagField и на import tagging

For the purposes of a simple test, I just commented out to start.
But later I got this error:
__init__() takes exactly 1 argument (5 given) вот тут views.py in project_list, line 13

The 13th line of the file itself looks like this:
**kwargs
I will give the views.py file itself:
from django.shortcuts import render_to_response, get_object_or_404
from django.template import RequestContext
from django.http import Http404
from django.views.generic import date_based, list_detail
from portfolio.models import Project, Medium
def project_list(request, page=0, **kwargs):
    return list_detail.object_list(
        request,
        queryset=Project.objects.public(),
        paginate_by=5,
        page=page,
        **kwargs
    )
project_list.__doc__ = list_detail.object_list.__doc__
def medium_list(request, **kwargs):
    return list_detail.object_list(
        request,
        queryset = Medium.objects.all(),
        **kwargs
    )

Well, the models.py file right away
from django.db import models
from django.utils.translation import ugettext_lazy as _
from django.db.models import permalink
from tagging.fields import TagField
from portfolio.managers import PublicManager
import tagging
class Client(models.Model):
    name = models.CharField(max_length=250)
    url = models.URLField(blank=True)
    
    class Meta:
        db_table = "clients"
        ordering = ['name']
        
    def __unicode__(self):
        return self.name
    
class Medium(models.Model):
    name = models.CharField(max_length=250)
    slug = models.SlugField()
    
    class Meta:
        db_table = "media"
        verbose_name_plural = "media"
        ordering = ['name']
    
    def __unicode__(self):
        return self.name
        
    @permalink
    def get_absolute_url(self):
        return self.slug
    
class Project(models.Model):
    name = models.CharField(max_length=250)
    slug = models.SlugField()
    project_url = models.URLField('Project URL')
    description = models.TextField(blank=True)
    client = models.ForeignKey(Client)
    media = models.ManyToManyField(Medium)
    disciplines = TagField()
    completion_date = models.DateField()
    in_development = models.BooleanField()
    is_public = models.BooleanField(default=True)
    overview_image = models.ImageField(upload_to="projects/overview/")
    detail_image = models.ImageField(upload_to="projects/detail/")
    objects         = PublicManager()
    
    class Meta:
        db_table = "projects"
        ordering = ['-completion_date']
        
    def __unicode__(self):
        return self.name
    
    @permalink
    def get_absolute_url(self):
        return self.slug

The files brought the original state without my edits, help run the application.
Sorry if the question is not framed correctly.

Answer the question

In order to leave comments, you need to log in

2 answer(s)
V
Valery, 2014-01-31
@Dead_Angel

Hmm, no traceback provided, but maybe you just forgot to install django-tagging which django-portfolio depends on.
In general, why don't you just look in the direction of fresher django batteries?
Here is a seemingly simple thing: https://github.com/dokterbob/django-portfolio
And this one is heavier: https://github.com/stefanfoulis/django-filer
But both seem to be maintained by the authors.

Y
Yuri Shikanov, 2014-01-25
@dizballanze

Have you read the upgrading instructions ?

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question