All pastes #674826 Raw Edit

Mine

public text v1 · immutable
#674826 ·published 2007-08-29 15:35 UTC
rendered paste body
# Imports
from django.db import models
from django.conf import settings
from django.contrib import auth

import os
from datetime import datetime

import innerTex

# (...)

# data contient une liste de tupple du genre :
# data = ((1,'titre du premier chapitre'),(5,'titre du deuxième chapitre'))

    def init(self,data):
        print "##################################" #DEBUG
        print data['index'] # DEBUG
        for i in data['index']:
            s = Section(html_repr=self,titre=i[1],page_debut=i[0])
            s.save()
            print "%s...............%s"%(i[1],i[0]) #DEBUG
  
# (...)

class Section(models.Model):
    """
    Une section du texte par classe section, chaque Section doit être
    rattachée à une représentation HtmlTex : self.html_repr.
    """
    html_repr = models.ForeignKey(HtmlTex)
    page_debut = models.SmallIntegerField()
    titre = models.CharField(maxlength=200)

# (...)