Submit
Path:
~
/
/
opt
/
cloudlinux
/
venv
/
lib
/
python3.11
/
site-packages
/
pylint_django
/
tests
/
input
/
File Content:
func_noerror_model_fields.py
""" Checks that Pylint does not complain about various methods on Django model fields. """ # pylint: disable=missing-docstring from __future__ import print_function from datetime import date, datetime from decimal import Decimal from django.db import models class LotsOfFieldsModel(models.Model): bigintegerfield = models.BigIntegerField() booleanfield = models.BooleanField(default=True) charfield = models.CharField(max_length=40, null=True) commaseparatedintegerfield = models.CommaSeparatedIntegerField() datetimefield = models.DateTimeField(auto_now_add=True) datefield = models.DateField(auto_now_add=True) decimalfield = models.DecimalField(max_digits=5, decimal_places=2) durationfield = models.DurationField() emailfield = models.EmailField() filefield = models.FileField(name="test_file", upload_to="test") filepathfield = models.FilePathField() floatfield = models.FloatField() genericipaddressfield = models.GenericIPAddressField() imagefield = models.ImageField(name="test_image", upload_to="test") ipaddressfield = models.IPAddressField() intfield = models.IntegerField(null=True) nullbooleanfield = models.NullBooleanField() positiveintegerfield = models.PositiveIntegerField() positivesmallintegerfield = models.PositiveSmallIntegerField() slugfield = models.SlugField() smallintegerfield = models.SmallIntegerField() textfield = models.TextField() timefield = models.TimeField() urlfield = models.URLField() def __str__(self): return self.id def boolean_field_tests(self): print(self.booleanfield | True) print(self.nullbooleanfield | True) def string_field_tests(self): print(self.charfield.strip()) print(self.charfield.upper()) print(self.charfield.replace("x", "y")) print(self.filepathfield.strip()) print(self.filepathfield.upper()) print(self.filepathfield.replace("x", "y")) print(self.emailfield.strip()) print(self.emailfield.upper()) print(self.emailfield.replace("x", "y")) print(self.textfield.strip()) print(self.textfield.upper()) print(self.textfield.replace("x", "y")) def datetimefield_tests(self): now = datetime.now() print(now - self.datetimefield) print(self.datetimefield.ctime()) def datefield_tests(self): now = date.today() print(now - self.datefield) print(self.datefield.isoformat()) def decimalfield_tests(self): print(self.decimalfield.compare(Decimal("1.4"))) def durationfield_tests(self): now = datetime.now() print(now - self.durationfield) print(self.durationfield.total_seconds()) def filefield_tests(self): self.filefield.save("/dev/null", "TEST") print(self.filefield.file) self.imagefield.save("/dev/null", "TEST") print(self.imagefield.file) def numberfield_tests(self): print(self.intfield + 5) print(self.bigintegerfield + 4) print(self.smallintegerfield + 3) print(self.positiveintegerfield + 2) print(self.positivesmallintegerfield + 1)
Edit
Rename
Chmod
Delete
FILE
FOLDER
Name
Size
Permission
Action
__pycache__
---
0755
migrations
---
0755
models
---
0755
test_app
---
0755
__init__.py
0 bytes
0644
external_django_tables2_noerror_meta_class.py
426 bytes
0644
external_drf_noerror_serializer.py
228 bytes
0644
external_drf_noerror_serializer.rc
40 bytes
0644
external_factory_boy_noerror.py
1524 bytes
0644
external_factory_boy_noerror.rc
33 bytes
0644
external_model_utils_noerror_override_manager.py
915 bytes
0644
external_model_utils_noerror_override_manager.rc
37 bytes
0644
external_psycopg2_noerror_postgres_fields.py
1626 bytes
0644
external_psycopg2_noerror_postgres_fields.rc
34 bytes
0644
external_tastypie_noerror_foreign_key.py
713 bytes
0644
func_hard_coded_auth_user.py
387 bytes
0644
func_hard_coded_auth_user.txt
260 bytes
0644
func_json_response.py
794 bytes
0644
func_json_response.txt
542 bytes
0644
func_model_does_not_use_unicode_py33.py
405 bytes
0644
func_model_does_not_use_unicode_py33.txt
116 bytes
0644
func_model_no_explicit_unicode_str_compat.py
484 bytes
0644
func_model_no_explicit_unicode_str_compat.txt
114 bytes
0644
func_modelform_exclude.py
239 bytes
0644
func_modelform_exclude.txt
112 bytes
0644
func_noerror_classviews.py
2730 bytes
0644
func_noerror_duplicate_except_doesnotexist.py
524 bytes
0644
func_noerror_factory_post_generation.py
425 bytes
0644
func_noerror_foreign_key_attributes.py
632 bytes
0644
func_noerror_foreign_key_ids.py
443 bytes
0644
func_noerror_foreign_key_key_cls_unbound.py
447 bytes
0644
func_noerror_foreign_key_package.py
359 bytes
0644
func_noerror_foreign_key_sets.py
842 bytes
0644
func_noerror_foreignkeys.py
2220 bytes
0644
func_noerror_form_fields.py
2421 bytes
0644
func_noerror_forms_py33.py
805 bytes
0644
func_noerror_formview_ancestors.py
210 bytes
0644
func_noerror_generic_foreign_key.py
613 bytes
0644
func_noerror_gettext_lazy_format.py
197 bytes
0644
func_noerror_ignore_meta_subclass.py
295 bytes
0644
func_noerror_import_q.py
160 bytes
0644
func_noerror_issue_46.py
211 bytes
0644
func_noerror_managers_return_querysets.py
1110 bytes
0644
func_noerror_manytomanyfield.py
1761 bytes
0644
func_noerror_model_fields.py
3220 bytes
0644
func_noerror_model_methods.py
610 bytes
0644
func_noerror_model_objects.py
472 bytes
0644
func_noerror_model_unicode_callable.py
350 bytes
0644
func_noerror_model_unicode_lambda.py
306 bytes
0644
func_noerror_models_py33.py
680 bytes
0644
func_noerror_protected_meta_access.py
691 bytes
0644
func_noerror_string_foreignkey.py
354 bytes
0644
func_noerror_style_members.py
314 bytes
0644
func_noerror_test_wsgi_request.py
567 bytes
0644
func_noerror_ugettext_lazy_format.py
200 bytes
0644
func_noerror_unicode_py2_compatible.py
441 bytes
0644
func_noerror_urls.py
478 bytes
0644
func_noerror_uuid_field.py
616 bytes
0644
func_noerror_views.py
151 bytes
0644
func_noerror_wsgi.py
380 bytes
0644
func_unused_arguments.py
1262 bytes
0644
func_unused_arguments.txt
148 bytes
0644
N4ST4R_ID | Naxtarrr