Giter Site home page Giter Site logo

Comments (4)

jezdez avatar jezdez commented on May 31, 2024

Hm, can you check the --help option whether the --overwrite option provides the way you want? The default is to always ask, you can chose another option as stated in the help text.

from django-dbtemplates.

elioscordo avatar elioscordo commented on May 31, 2024

Thank you for the answer. I would like to create new template with dbtemplate and then write them for translation.
This is what I have written for sync:

    try:
        site = Site.objects.get_current()
    except:
        raise CommandError("Please make sure to have the sites contrib "
                           "app installed and setup with a site object")
    tpl_dirs = settings.TEMPLATE_DIRS + app_template_dirs
    templatedirs = [d for d in tpl_dirs if os.path.isdir(d)]
    templates = Template.objects.all()
    for template in templates:
        folder = template.name.split("/")[0]
        for templatedir in templatedirs:
            path_to_check = os.path.join(templatedir , folder)
            if os.path.isdir(path_to_check):
                f = codecs.open(os.path.join(path_to_check , template.name.split("/")[1]), 'w', 'utf-8')
                try:
                    f.write(template.content)
                finally:
                    f.close()

from django-dbtemplates.

mcat-ee avatar mcat-ee commented on May 31, 2024

@jezdez is the --help information accessed through ./manage.py sync_templates --help?

If so, this is causing a TypeError for me :(

from django-dbtemplates.

chakibBH avatar chakibBH commented on May 31, 2024

@mcat-ee , I stumb on this too, looks like a '%' lost itself on a commit :)
dbtemplates/management/commands/sync_templates.py (line30)
"sync with the database [default: %default]")

from django-dbtemplates.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.