4259 links
  • Arnaud's links
  • Home
  • RSS Feed
  • Tag cloud
  • Login
search: tag:django — newest first
  • netbox-community/netbox: The premiere source of truth powering network automation. Open source under Apache 2. Public demo: https://demo.netbox.dev
    November 2, 2022 - permalink - https://github.com/netbox-community/netbox
    django ipam network
  • python - Django template can't loop defaultdict - Stack Overflow

    django template does not like defaultdict, 2 solutions:
    1) set default_factory to None
    or
    2) cast defaultdict to a simpledict

    "The template variable resolution algorithm in Django will attempt to resolve new_data.items as new_data['items'] first, which resolves to an empty list when using defaultdict(list)."

    December 29, 2021 - permalink - https://stackoverflow.com/questions/4764110/django-template-cant-loop-defaultdict
    defaultdict django python
  • Built-in class-based views API | Django documentation | Django

    all django generic views included

    October 17, 2021 - permalink - https://docs.djangoproject.com/en/3.2/ref/class-based-views/
    django generic view
  • Class-Based Views in Django. Creating CRUD interfaces with DRY… | by Taranjeet Singh | All About Django | Medium

    Class-Based Views in Django to DRY

    October 17, 2021 - permalink - https://medium.com/all-about-django/class-based-views-in-django-89108c1f51fb
    class` django view
  • Référence de l’API QuerySet | Documentation de Django | Django

    useful one!

    September 27, 2021 - permalink - https://docs.djangoproject.com/fr/3.2/ref/models/querysets/#get-or-create
    django
  • django-bootstrap-datepicker-plus · PyPI
    December 6, 2020 - permalink - https://pypi.org/project/django-bootstrap-datepicker-plus/
    datetime django widget
  • GitHub - jazzband/django-axes: Keep track of failed login attempts in Django-powered sites.
    November 30, 2020 - permalink - https://github.com/jazzband/django-axes
    django security
  • Time zones | Django documentation | Django
    November 6, 2020 - permalink - https://docs.djangoproject.com/en/3.1/topics/i18n/timezones/
    django python timezone
  • python - Displaying a timedelta object in a django template - Stack Overflow

    Here's my filter code

    from django import template

    register = template.Library()

    @register.filter()
    def smooth_timedelta(timedeltaobj):
    """Convert a datetime.timedelta object into Days, Hours, Minutes, Seconds."""
    secs = timedeltaobj.total_seconds()
    timetot = ""
    if secs > 86400: # 60sec * 60min * 24hrs
    days = secs // 86400
    timetot += "{} days".format(int(days))
    secs = secs - days*86400

    if secs > 3600:
        hrs = secs // 3600
        timetot += " {} hours".format(int(hrs))
        secs = secs - hrs*3600
    
    if secs > 60:
        mins = secs // 60
        timetot += " {} minutes".format(int(mins))
        secs = secs - mins*60
    
    if secs > 0:
        timetot += " {} seconds".format(int(secs))
    return timetot
    

    Then in my template I did

    {% load smooth_timedelta %}

    {% timedeltaobject|smooth_timedelta %}

    October 29, 2020 - permalink - https://stackoverflow.com/questions/16348003/displaying-a-timedelta-object-in-a-django-template
    django filter python
  • Django and its default values. A little story of a common Django… | by David Wobrock | Botify Labs | Sep, 2020 | Medium
    September 18, 2020 - permalink - https://medium.com/botify-labs/django-and-its-default-values-c21a13cff9f
    default django sql
  • Django-Forms with json fields - Stack Overflow
    June 18, 2020 - permalink - https://stackoverflow.com/questions/14626702/django-forms-with-json-fields
    django json
  • GitHub - django-ses/django-ses: A Django email backend for Amazon's Simple Email Service
    June 15, 2020 - permalink - https://github.com/django-ses/django-ses
    aws django mail ses
  • Django Tutorial Part 8: User authentication and permissions - Learn web development | MDN
    June 12, 2020 - permalink - https://developer.mozilla.org/en-US/docs/Learn/Server-side/Django/Authentication
    django
  • Django ALLOWED_HOSTS for Amazon ELB - Stack Overflow

    Another simple solution would be to write a custom MIDDLEWARE which will give the response to ELB before the ALLOWED_HOSTS is checked. So now you don't have to load ALLOWED_HOSTS dynamically.

    The middleware can be as simple as:

    project/app/middleware.py

    from django.http import HttpResponse
    from django.utils.deprecation import MiddlewareMixin

    class HealthCheckMiddleware(MiddlewareMixin):
    def process_request(self, request):
    if request.META["PATH_INFO"] == "/ping/":
    return HttpResponse("pong")

    settings.py

    MIDDLEWARE = [
    'corsheaders.middleware.CorsMiddleware',
    'app.middleware.HealthCheckMiddleware',
    'django.middleware.security.SecurityMiddleware',
    'django.contrib.sessions.middleware.SessionMiddleware',
    'django.middleware.common.CommonMiddleware',
    'django.middleware.csrf.CsrfViewMiddleware',
    ...
    ]

    Django Middleware reference https://docs.djangoproject.com/en/dev/topics/http/middleware/

    June 10, 2020 - permalink - https://stackoverflow.com/questions/35858040/django-allowed-hosts-for-amazon-elb
    alb aws django elb
  • Multiple databases | Django documentation | Django
    June 8, 2020 - permalink - https://docs.djangoproject.com/en/3.0/topics/db/multi-db/
    database django
  • Django, paths and URLs | Occasionally sane
    February 2, 2014 - permalink - http://gnuvince.wordpress.com/2007/12/22/django-paths-and-urls/
    django path
  • Chapter 12: Deploying Django

    Comment passer en prod une app django

    December 12, 2013 - permalink - http://www.djangobook.com/en/2.0/chapter12.html
    django prod
  • How to use Django with Apache and mod_wsgi | Django documentation | Django
    December 8, 2013 - permalink - https://docs.djangoproject.com/en/1.1/howto/deployment/modwsgi/
    django
  • How to use Django with Apache and mod_wsgi | Django documentation | Django
    December 8, 2013 - permalink - https://docs.djangoproject.com/en/1.2/howto/deployment/modwsgi/
    django