This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <html> | |
| <head></head> | |
| <body> | |
| <style> | |
| #banner-image-holder{ | |
| background-image: url(''); /* can load with a default image */ | |
| background-repeat: no-repeat; | |
| background-position: center; | |
| background-size: 100% auto; | |
| box-shadow: inset 0 0 15px 0px black; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // Ancestor Selector | |
| function ancestor(selector, ancestor, rule) { | |
| let styles = '' | |
| let count = 0 | |
| Array.from(document.querySelectorAll(ancestor)) | |
| .filter(tag => tag.querySelector(selector)) | |
| .forEach(tag => { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| textarea { | |
| overflow-wrap: break-word; | |
| -webkit-appearance: textarea; | |
| border: none; | |
| -webkit-rtl-ordering: logical; | |
| -webkit-user-select: text; | |
| -webkit-box-orient: vertical; | |
| background: transparent none repeat scroll 0 0 !important; | |
| z-index: auto; | |
| resize: vertical; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| class A(models.Model): | |
| things = models.ManyToManyField("B", through=ThroughModel) | |
| class B(models.Model): | |
| text = models.TextField() | |
| class ThroughModel(models.Model): | |
| a = models.ForeignKey(A) | |
| b = models.ForeignKey(B) | |
| extra = models.BooleanField() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| from django.db import models | |
| from django.db.models.base import ModelBase | |
| from .image_url_to_file import image_url_to_file | |
| class ImageParserMixin(object): | |
| """ | |
| ImageParser Class is used to parse an image from external url and save it to model field |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| wget https://www.python.org/ftp/python/3.6.3/Python-3.6.3.tgz | |
| tar xvf Python-3.6.3.tgz | |
| cd Python-3.6.3 | |
| ./configure --enable-optimizations | |
| make -j8 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # Subdomains | |
| https://wellfire.co/learn/multi-tennancy-in-django-using-subdomains/ | |
| # Django Mini CMS | |
| https://wellfire.co/learn/snippet-editing-with-django-addendum/ | |
| # Enhance an image / give an Outlay | |
| https://wellfire.co/learn/python-image-enhancements/ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <form method="post"> | |
| {% csrf_token %} | |
| {% for field in form %} | |
| {% if field.name == 'mobile_alternative' %}<hr />{% endif %} | |
| <div class="form-group m-form__group row"> | |
| <label class="col-xl-3 col-lg-3 col-form-label"> | |
| {{ field.label }}{% if field.field.required %}<span style="color:#8b0000">*</span> {% endif %}: | |
| </label> | |
| <div class="col-xl-9 col-lg-9"> | |
| {{ field }} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # from common.models import SubscriptionPlan | |
| def clean(self): | |
| """ | |
| * Suppose, if a user needs to subscribe a feature from start_date 'A' to end_date 'B' | |
| * This Django model form's 'clean' method validates allocating the feature over a particular time slot. | |
| * This methods also ensures these dates donot conflict with any other active subscriptions. | |
| * | |
| * form input must contain dates 'start_date' and 'end_date' | |
| * Django Model (here: `SubscriptionPlan`) with equivalent fields for `activation_date` and `expiry_date` |