This file contains 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
{ | |
"name": "workolio", | |
"version": "0.1.0", | |
"dependencies": {}, | |
"devDependencies": { | |
"chai": "^4.3.0", | |
"chalk": "^4.1.0", | |
"cssmin": "^0.4.3", | |
"grunt": "^1.3.0", | |
"grunt-cli": "^1.3.2", |
This file contains 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_css = response.css('main[class^="D_"] ::attr(class)').getall()[12] | |
url = response.css('a[class^="%s"] ::attr(href)'% class_css).get() | |
print (url) |
This file contains 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
urls.py | |
============================ | |
from django.urls import path | |
# Your path of views | |
from apps.main.views import main, set_language_from_url | |
urlpatterns = [ | |
... | |
path("set_language/<str:user_language>/", set_language_from_url, name="set_language_from_url") |
This file contains 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
{% load i18n%} | |
<title>{% trans "This is the title." %}</title> | |
{% blocktrans %}This string will have {{ value }} inside.{% endblocktrans %} | |
<ul id="nav"> | |
<a href='/'>{% trans "Jobs" %}</a> | |
<a href="{% url 'jobs:companies' %}" class=">{% trans "Startups" %}</a> | |
</ul> |
This file contains 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.utils.translation import gettext_lazy as _ | |
BASE_DIR = os.path.dirname(os.path.dirname(__file__)) | |
INSTALLED_APPS = ( | |
... | |
"translation_manager", | |
... | |
) |
This file contains 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
import environ | |
from django.utils.translation import gettext_lazy as _ | |
ROOT_DIR = environ.Path(__file__) - 3 | |
APPS_DIR = ROOT_DIR.path("apps") | |
INSTALLED_APPS = ( | |
... | |
"translation_manager", | |
... |
This file contains 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
''' | |
1. Counter digunakan untuk menjumlahkan berapa banyak looping yang terjadi, dimana angka tersebut bisa kita gunakan | |
Untuk berbagai keperluan. | |
misalnya terdapat url yang punya page_number dan kita ingin mendapatkan halaman 1,2,3 dst | |
maka website.com/jobs?keywords=python&page_num=<hasil di taruh di sini 1,2,3> | |
hasilnya | |
website.com/jobs?keywords=python&page_num=1 | |
website.com/jobs?keywords=python&page_num=2 | |
website.com/jobs?keywords=python&page_num=3 |
This file contains 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
repos: | |
- repo: git://github.com/pre-commit/pre-commit-hooks | |
rev: v1.4.0 | |
hooks: | |
- id: end-of-file-fixer | |
- id: trailing-whitespace | |
- id: check-case-conflict | |
- id: check-merge-conflict | |
- id: check-yaml | |
args: ['--unsafe'] |
This file contains 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 User(AbstractUser, Timestampable): | |
id = models.UUIDField( | |
primary_key=True, | |
default=uuid.uuid4, | |
editable=False) | |
customer = models.ForeignKey(Customer, null=True, blank=True, on_delete=models.SET_NULL) | |
subscription = models.ForeignKey(Subscription, null=True, blank=True, on_delete=models.SET_NULL) | |
payment_id = models.CharField(max_length=255, blank=True) |
This file contains 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
import uuid | |
from django.db import models | |
from django.contrib.auth.models import AbstractUser | |
from djstripe.models import Customer, Subscription, PaymentMethod | |
class BaseCustomer(models.Model): | |
customer = models.ForeignKey(Customer, null=True, blank=True, on_delete=models.SET_NULL) | |
subscription = models.ForeignKey(Subscription, null=True, blank=True, on_delete=models.SET_NULL) | |
payment_id = models.CharField(max_length=255, blank=True) | |
class Meta: |