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
update tabela | |
set nome = (replace(replace(replace(regexp_replace((initcap(nome)), '[^A-zÀ-ú]', ' ', 'g'),' Do ', ' do '), ' De ', ' de '), ' Da ', ' da ')) |
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
<!-- 4. Criar link no template html --> | |
<p> | |
<a href="{% url 'blog:post_share' post.id %}">Share this post</a> | |
</p> |
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 Person(models.Model): | |
first_name = models.CharField(max_length=30) | |
last_name = models.CharField(max_length=30) | |
age = models.PositiveIntegerField() | |
def __str__(self): | |
return self.first_name | |
class Majority(models.Manager): |
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
def get_actions(self, request): | |
actions = super().get_actions(request) | |
if 'delete_selected' in actions: | |
del actions['delete_selected'] | |
return actions |
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
# Processa patentes | |
def get_despachos_patentes_INPI(ip_type, Patent): | |
if ip_type == 'Patente': | |
ip_id = Patent.objects.values_list('patent_id', flat=True).filter(active=True) | |
if ip_id: | |
for despatch in doc.iterfind('despacho'): | |
for process in despatch.iterfind('processo-patente'): | |
number = process.findtext('numero') | |
if number in ip_id: | |
qtd_finded += 1 |
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
INSERT INTO config_icon(name, image_mdb) | |
VALUES ('axis arrow info', 'mdi-axis-arrow-info'), | |
('baby buggy', 'mdi-baby-buggy'), | |
('beehive off outline', 'mdi-beehive-off-outline'), | |
('bell cancel', 'mdi-bell-cancel'), | |
('bell cancel outline', 'mdi-bell-cancel-outline'), | |
('bell minus', 'mdi-bell-minus'), | |
('bell minus outline', 'mdi-bell-minus-outline'), | |
('bell remove', 'mdi-bell-remove'), | |
('bell remove outline', 'mdi-bell-remove-outline'), |
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
def get_symbol_default(): | |
""" | |
Busca pelo ícone padrão do sistema | |
:return: retorna o valor default do | |
""" | |
try: | |
default_icon = Default.objects.first().get('default_icon') | |
except BaseException as error: | |
raise BaseException(_('Register a default icon.')) from error | |
return default_icon |
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
def logged(level, name=None, message=None): | |
def decorate(func): | |
logname = name if name else func.__name__ | |
log = logging.getLogger(logname) | |
logmsg = message if message else func.__name__ | |
@wraps(func) | |
def wrapper(*args, **kwargs): | |
log.log(level, logmsg) | |
return func(*args, **kwargs) |
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 ArticleForm(forms.ModelForm): | |
brief_summary = forms.CharField( | |
widget=TinyMCE( | |
attrs={ | |
'cols': 80, | |
'rows': 50 | |
} | |
) | |
) |
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 ArticleForm(forms.ModelForm): | |
brief_summary = forms.CharField( | |
widget=TinyMCE( | |
attrs={ | |
'cols': 80, | |
'rows': 50 | |
} | |
) | |
) |