././@PaxHeader0000000000000000000000000000003300000000000011451 xustar000000000000000027 mtime=1620584586.402187 django-macaddress-1.8.0/0000775000175000017500000000000000000000000014613 5ustar00kra3kra300000000000000././@PaxHeader0000000000000000000000000000002600000000000011453 xustar000000000000000022 mtime=1598800097.0 django-macaddress-1.8.0/LICENSE0000664000175000017500000000277100000000000015627 0ustar00kra3kra300000000000000Copyright (c) 2011 Ryan Nowakowski All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. 3. Neither the name of this project nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. ././@PaxHeader0000000000000000000000000000002600000000000011453 xustar000000000000000022 mtime=1598800097.0 django-macaddress-1.8.0/MANIFEST.in0000664000175000017500000000004400000000000016347 0ustar00kra3kra300000000000000include LICENSE include README.rst ././@PaxHeader0000000000000000000000000000003300000000000011451 xustar000000000000000027 mtime=1620584586.402187 django-macaddress-1.8.0/PKG-INFO0000664000175000017500000001336100000000000015714 0ustar00kra3kra300000000000000Metadata-Version: 1.2 Name: django-macaddress Version: 1.8.0 Summary: MAC address model and form fields for Django apps. Home-page: http://github.com/tubaman/django-macaddress Author: Ryan Nowakowski Author-email: tubaman@fattuba.com Maintainer: Arun Karunagath Maintainer-email: the1.arun@gmail.com License: BSD Description: django-macaddress ================== .. image:: https://travis-ci.org/django-macaddress/django-macaddress.svg?branch=master :alt: Build Status :target: https://travis-ci.org/django-macaddress/django-macaddress .. image:: https://img.shields.io/pypi/v/django-macaddress.svg :target: https://crate.io/packages/django-macaddress MAC Address model and form fields for Django We use netaddr to parse and validate the MAC address. The tests aren't complete yet. Patches welcome: http://github.com/django-macaddress/django-macaddress Release Notes: ************** For release info: https://github.com/django-macaddress/django-macaddress/releases Getting Started *************** settings.MACADDRESS_DEFAULT_DIALECT ----------------------------------- To specify a default dialect for presentation (and storage, see below), specify:: settings.MACADDRESS_DEFAULT_DIALECT = 'module.dialect_class' where the specified value is a string composed of a parent python module name and the child dialect class name. For example:: settings.MACADDRESS_DEFAULT_DIALECT = 'netaddr.mac_eui48' PS: old default of macaddress.mac_linux (uppercase and divided by ':' ) will be used by default. If the custom dialect is defined in a package module, you will need to define the class in or import into the package's ``__init__.py``. ``default_dialect`` and ``format_mac`` -------------------------------------- To get the default dialect for your project, import and call the ``default_dialect`` function:: >>> from macaddress import default_dialect >>> dialect = default_dialect() This function may, optionally, be called with an ``netaddr.EUI`` class instance as its argument. If no default is defined in ``settings``, it will return the dialect of the provided ``EUI`` object. The ``format_mac`` function takes an ``EUI`` instance and a dialect class (``netaddr.mac_eui48`` or a subclass) as its arguments. The dialect class may be specified as a string in the same manner as ``settings.MACADDRESS_DEFAULT_DIALECT``:: >>> from netaddr import EUI, mac_bare >>> from macaddress import format_mac >>> mac = EUI('00:12:3c:37:64:8f') >>> format_mac(mac, mac_bare) '00123C37648F' >>> format_mac(mac, 'netaddr.mac_cisco') '0012.3c37.648f' MACAddressField (ModelField) ---------------------------- This is an example model using MACAddressField:: from macaddress.fields import MACAddressField class Computer(models.Model): name = models.CharField(max_length=32) eth0 = MACAddressField(null=True, blank=True) ... The default behavior is to store the MAC Address in the database is a BigInteger. If you would, rather, store the value as a string (to, for instance, facilitate sub-string searches), you can specify ``integer=False`` and the value will be stored as a string:: class Computer(models.Model): name = models.CharField(max_length=32) eth0 = MACAddressField(blank=True, integer=False) ... If you want to set ``unique=True`` on a MACAddressField that is stored as a string, you will need to set ``null=True`` and create custom ``clean_`` methods on your ``forms.ModelForm`` class for each MACAddressField that return ``None`` when the value provided is an ``''`` (empty string):: from .models import Computer class ComputerForm(forms.ModelForm): class Meta: model = Computer def clean_eth0(self): return self.cleaned_data['eth0'] or None You should avoid changing the value of ``integer`` after running ``managy.py syncdb``, unless you are using a schema migration solution like South or Django's built-in migrations. To Do ***** + Add greater support for partial string queries when storing MACs as strings in the database. + Add custom validator to check for duplicate MACs when mixing string and integer storage types. + Add deprecation warning and timeline for changeover to default string storage. Platform: UNKNOWN Classifier: Development Status :: 5 - Production/Stable Classifier: Framework :: Django Classifier: Intended Audience :: Developers Classifier: License :: OSI Approved :: BSD License Classifier: Operating System :: OS Independent Classifier: Programming Language :: Python Classifier: Programming Language :: Python :: 3 Classifier: Programming Language :: Python :: 3 :: Only Classifier: Programming Language :: Python :: 3.5 Classifier: Programming Language :: Python :: 3.6 Classifier: Programming Language :: Python :: 3.7 Classifier: Programming Language :: Python :: 3.8 Classifier: Topic :: Internet :: WWW/HTTP ././@PaxHeader0000000000000000000000000000002600000000000011453 xustar000000000000000022 mtime=1598800097.0 django-macaddress-1.8.0/README.rst0000664000175000017500000000770500000000000016313 0ustar00kra3kra300000000000000django-macaddress ================== .. image:: https://travis-ci.org/django-macaddress/django-macaddress.svg?branch=master :alt: Build Status :target: https://travis-ci.org/django-macaddress/django-macaddress .. image:: https://img.shields.io/pypi/v/django-macaddress.svg :target: https://crate.io/packages/django-macaddress MAC Address model and form fields for Django We use netaddr to parse and validate the MAC address. The tests aren't complete yet. Patches welcome: http://github.com/django-macaddress/django-macaddress Release Notes: ************** For release info: https://github.com/django-macaddress/django-macaddress/releases Getting Started *************** settings.MACADDRESS_DEFAULT_DIALECT ----------------------------------- To specify a default dialect for presentation (and storage, see below), specify:: settings.MACADDRESS_DEFAULT_DIALECT = 'module.dialect_class' where the specified value is a string composed of a parent python module name and the child dialect class name. For example:: settings.MACADDRESS_DEFAULT_DIALECT = 'netaddr.mac_eui48' PS: old default of macaddress.mac_linux (uppercase and divided by ':' ) will be used by default. If the custom dialect is defined in a package module, you will need to define the class in or import into the package's ``__init__.py``. ``default_dialect`` and ``format_mac`` -------------------------------------- To get the default dialect for your project, import and call the ``default_dialect`` function:: >>> from macaddress import default_dialect >>> dialect = default_dialect() This function may, optionally, be called with an ``netaddr.EUI`` class instance as its argument. If no default is defined in ``settings``, it will return the dialect of the provided ``EUI`` object. The ``format_mac`` function takes an ``EUI`` instance and a dialect class (``netaddr.mac_eui48`` or a subclass) as its arguments. The dialect class may be specified as a string in the same manner as ``settings.MACADDRESS_DEFAULT_DIALECT``:: >>> from netaddr import EUI, mac_bare >>> from macaddress import format_mac >>> mac = EUI('00:12:3c:37:64:8f') >>> format_mac(mac, mac_bare) '00123C37648F' >>> format_mac(mac, 'netaddr.mac_cisco') '0012.3c37.648f' MACAddressField (ModelField) ---------------------------- This is an example model using MACAddressField:: from macaddress.fields import MACAddressField class Computer(models.Model): name = models.CharField(max_length=32) eth0 = MACAddressField(null=True, blank=True) ... The default behavior is to store the MAC Address in the database is a BigInteger. If you would, rather, store the value as a string (to, for instance, facilitate sub-string searches), you can specify ``integer=False`` and the value will be stored as a string:: class Computer(models.Model): name = models.CharField(max_length=32) eth0 = MACAddressField(blank=True, integer=False) ... If you want to set ``unique=True`` on a MACAddressField that is stored as a string, you will need to set ``null=True`` and create custom ``clean_`` methods on your ``forms.ModelForm`` class for each MACAddressField that return ``None`` when the value provided is an ``''`` (empty string):: from .models import Computer class ComputerForm(forms.ModelForm): class Meta: model = Computer def clean_eth0(self): return self.cleaned_data['eth0'] or None You should avoid changing the value of ``integer`` after running ``managy.py syncdb``, unless you are using a schema migration solution like South or Django's built-in migrations. To Do ***** + Add greater support for partial string queries when storing MACs as strings in the database. + Add custom validator to check for duplicate MACs when mixing string and integer storage types. + Add deprecation warning and timeline for changeover to default string storage. ././@PaxHeader0000000000000000000000000000003300000000000011451 xustar000000000000000027 mtime=1620584586.402187 django-macaddress-1.8.0/django_macaddress.egg-info/0000775000175000017500000000000000000000000021735 5ustar00kra3kra300000000000000././@PaxHeader0000000000000000000000000000002600000000000011453 xustar000000000000000022 mtime=1620584586.0 django-macaddress-1.8.0/django_macaddress.egg-info/PKG-INFO0000664000175000017500000001336100000000000023036 0ustar00kra3kra300000000000000Metadata-Version: 1.2 Name: django-macaddress Version: 1.8.0 Summary: MAC address model and form fields for Django apps. Home-page: http://github.com/tubaman/django-macaddress Author: Ryan Nowakowski Author-email: tubaman@fattuba.com Maintainer: Arun Karunagath Maintainer-email: the1.arun@gmail.com License: BSD Description: django-macaddress ================== .. image:: https://travis-ci.org/django-macaddress/django-macaddress.svg?branch=master :alt: Build Status :target: https://travis-ci.org/django-macaddress/django-macaddress .. image:: https://img.shields.io/pypi/v/django-macaddress.svg :target: https://crate.io/packages/django-macaddress MAC Address model and form fields for Django We use netaddr to parse and validate the MAC address. The tests aren't complete yet. Patches welcome: http://github.com/django-macaddress/django-macaddress Release Notes: ************** For release info: https://github.com/django-macaddress/django-macaddress/releases Getting Started *************** settings.MACADDRESS_DEFAULT_DIALECT ----------------------------------- To specify a default dialect for presentation (and storage, see below), specify:: settings.MACADDRESS_DEFAULT_DIALECT = 'module.dialect_class' where the specified value is a string composed of a parent python module name and the child dialect class name. For example:: settings.MACADDRESS_DEFAULT_DIALECT = 'netaddr.mac_eui48' PS: old default of macaddress.mac_linux (uppercase and divided by ':' ) will be used by default. If the custom dialect is defined in a package module, you will need to define the class in or import into the package's ``__init__.py``. ``default_dialect`` and ``format_mac`` -------------------------------------- To get the default dialect for your project, import and call the ``default_dialect`` function:: >>> from macaddress import default_dialect >>> dialect = default_dialect() This function may, optionally, be called with an ``netaddr.EUI`` class instance as its argument. If no default is defined in ``settings``, it will return the dialect of the provided ``EUI`` object. The ``format_mac`` function takes an ``EUI`` instance and a dialect class (``netaddr.mac_eui48`` or a subclass) as its arguments. The dialect class may be specified as a string in the same manner as ``settings.MACADDRESS_DEFAULT_DIALECT``:: >>> from netaddr import EUI, mac_bare >>> from macaddress import format_mac >>> mac = EUI('00:12:3c:37:64:8f') >>> format_mac(mac, mac_bare) '00123C37648F' >>> format_mac(mac, 'netaddr.mac_cisco') '0012.3c37.648f' MACAddressField (ModelField) ---------------------------- This is an example model using MACAddressField:: from macaddress.fields import MACAddressField class Computer(models.Model): name = models.CharField(max_length=32) eth0 = MACAddressField(null=True, blank=True) ... The default behavior is to store the MAC Address in the database is a BigInteger. If you would, rather, store the value as a string (to, for instance, facilitate sub-string searches), you can specify ``integer=False`` and the value will be stored as a string:: class Computer(models.Model): name = models.CharField(max_length=32) eth0 = MACAddressField(blank=True, integer=False) ... If you want to set ``unique=True`` on a MACAddressField that is stored as a string, you will need to set ``null=True`` and create custom ``clean_`` methods on your ``forms.ModelForm`` class for each MACAddressField that return ``None`` when the value provided is an ``''`` (empty string):: from .models import Computer class ComputerForm(forms.ModelForm): class Meta: model = Computer def clean_eth0(self): return self.cleaned_data['eth0'] or None You should avoid changing the value of ``integer`` after running ``managy.py syncdb``, unless you are using a schema migration solution like South or Django's built-in migrations. To Do ***** + Add greater support for partial string queries when storing MACs as strings in the database. + Add custom validator to check for duplicate MACs when mixing string and integer storage types. + Add deprecation warning and timeline for changeover to default string storage. Platform: UNKNOWN Classifier: Development Status :: 5 - Production/Stable Classifier: Framework :: Django Classifier: Intended Audience :: Developers Classifier: License :: OSI Approved :: BSD License Classifier: Operating System :: OS Independent Classifier: Programming Language :: Python Classifier: Programming Language :: Python :: 3 Classifier: Programming Language :: Python :: 3 :: Only Classifier: Programming Language :: Python :: 3.5 Classifier: Programming Language :: Python :: 3.6 Classifier: Programming Language :: Python :: 3.7 Classifier: Programming Language :: Python :: 3.8 Classifier: Topic :: Internet :: WWW/HTTP ././@PaxHeader0000000000000000000000000000002600000000000011453 xustar000000000000000022 mtime=1620584586.0 django-macaddress-1.8.0/django_macaddress.egg-info/SOURCES.txt0000664000175000017500000000065700000000000023631 0ustar00kra3kra300000000000000LICENSE MANIFEST.in README.rst setup.cfg setup.py django_macaddress.egg-info/PKG-INFO django_macaddress.egg-info/SOURCES.txt django_macaddress.egg-info/dependency_links.txt django_macaddress.egg-info/requires.txt django_macaddress.egg-info/top_level.txt macaddress/__init__.py macaddress/fields.py macaddress/formfields.py macaddress/models.py macaddress/tests/__init__.py macaddress/tests/models.py macaddress/tests/test_fields.py././@PaxHeader0000000000000000000000000000002600000000000011453 xustar000000000000000022 mtime=1620584586.0 django-macaddress-1.8.0/django_macaddress.egg-info/dependency_links.txt0000664000175000017500000000000100000000000026003 0ustar00kra3kra300000000000000 ././@PaxHeader0000000000000000000000000000002600000000000011453 xustar000000000000000022 mtime=1620584586.0 django-macaddress-1.8.0/django_macaddress.egg-info/requires.txt0000664000175000017500000000001000000000000024324 0ustar00kra3kra300000000000000netaddr ././@PaxHeader0000000000000000000000000000002600000000000011453 xustar000000000000000022 mtime=1620584586.0 django-macaddress-1.8.0/django_macaddress.egg-info/top_level.txt0000664000175000017500000000001300000000000024461 0ustar00kra3kra300000000000000macaddress ././@PaxHeader0000000000000000000000000000003300000000000011451 xustar000000000000000027 mtime=1620584586.402187 django-macaddress-1.8.0/macaddress/0000775000175000017500000000000000000000000016721 5ustar00kra3kra300000000000000././@PaxHeader0000000000000000000000000000002600000000000011453 xustar000000000000000022 mtime=1598800097.0 django-macaddress-1.8.0/macaddress/__init__.py0000664000175000017500000000476500000000000021046 0ustar00kra3kra300000000000000from django.conf import settings from netaddr import mac_unix, mac_eui48 import importlib import warnings class mac_linux(mac_unix): """MAC format with zero-padded all upper-case hex and colon separated""" word_fmt = '%.2X' def default_dialect(eui_obj=None): # Check to see if a default dialect class has been specified in settings, # using 'module.dialect_cls' string and use importlib and getattr to retrieve dialect class. 'module' is the module and # 'dialect_cls' is the class name of the custom dialect. The dialect must either be defined or imported by the module's # __init__.py if the module is a package. from .fields import MACAddressField # Remove import at v1.4 if hasattr(settings, 'MACADDRESS_DEFAULT_DIALECT') and not MACAddressField.dialect: module, dialect_cls = settings.MACADDRESS_DEFAULT_DIALECT.split('.') dialect = getattr(importlib.import_module(module), dialect_cls, mac_linux) return dialect else: if MACAddressField.dialect: # Remove this "if" statement at v1.4 warnings.warn( "The set_dialect class method on MACAddressField has been deprecated, in favor of the default_dialect " "utility function and settings.MACADDRESS_DEFAULT_DIALECT. See macaddress.__init__.py source or the " "project README for more information.", DeprecationWarning, ) return MACAddressField.dialect if eui_obj: return eui_obj.dialect else: return mac_linux def format_mac(eui_obj, dialect): # Format a EUI instance as a string using the supplied dialect class, allowing custom string classes by # passing directly or as a string, a la 'module.dialect_cls', where 'module' is the module and 'dialect_cls' # is the class name of the custom dialect. The dialect must either be defined or imported by the module's __init__.py if # the module is a package. if not isinstance(dialect, mac_eui48): if isinstance(dialect, str): module, dialect_cls = dialect.split('.') dialect = getattr(importlib.import_module(module), dialect_cls) eui_obj.dialect = dialect return str(eui_obj) from pkg_resources import get_distribution, DistributionNotFound import os.path try: _dist = get_distribution('django-macaddress') except DistributionNotFound: __version__ = 'Please install this project with setup.py' else: __version__ = _dist.version VERSION = __version__ # synonym ././@PaxHeader0000000000000000000000000000002600000000000011453 xustar000000000000000022 mtime=1598800097.0 django-macaddress-1.8.0/macaddress/fields.py0000664000175000017500000000716000000000000020545 0ustar00kra3kra300000000000000import django from django.core.exceptions import ValidationError from django.db import models from netaddr import EUI, AddrFormatError from .formfields import MACAddressField as MACAddressFormField from . import default_dialect, format_mac, mac_linux import warnings class MACAddressField(models.Field): description = "A MAC address validated by netaddr.EUI" empty_strings_allowed = False dialect = None def __init__(self, *args, **kwargs): self.integer = kwargs.pop('integer', True) if not self.integer: # If storing MAC address as string, set max_length to default (17) or use supplied kwarg value. kwargs['max_length'] = kwargs.get('max_length', 17) super(MACAddressField, self).__init__(*args, **kwargs) def deconstruct(self): ''' Django 1.7 migrations require this method https://docs.djangoproject.com/en/dev/howto/custom-model-fields/#field-deconstruction ''' name, path, args, kwargs = super(MACAddressField, self).deconstruct() kwargs['integer'] = self.integer return name, path, args, kwargs @classmethod def set_dialect(cls, new_dialect_clazz): ''' Setting dialect for EUI (MAC addresses) globally to this Field class. Class new_dialect_clazz should (finally) extend netaddr.strategy.eui48.mac_eui48. ''' warnings.warn( "The set_dialect method has been deprecated, in favor of the default_dialect utility function and " " settings.MACADDRESS_DEFAULT_DIALECT. See macaddress.__init__.py source or the project README for " "more information.", DeprecationWarning, ) cls.dialect = new_dialect_clazz def get_prep_value(self, value): if value is None: return None if not isinstance(value, EUI): value = self.to_python(value) if self.integer: return int(value) return str(value) value.dialect = default_dialect(self) if self.integer: return int(value) return str(value) def get_internal_type(self): if self.integer: return 'BigIntegerField' return 'CharField' def from_db_value(self, value, expression, connection): return self.to_python(value) def to_python(self, value): if value is None: return value if isinstance(value, EUI): value.dialect = default_dialect(value) return value try: return EUI(value, version=48, dialect=default_dialect()) except (TypeError, ValueError, AddrFormatError): raise ValidationError("This value must be a valid MAC address.") def formfield(self, **kwargs): defaults = {'form_class': MACAddressFormField} defaults.update(kwargs) return super(MACAddressField, self).formfield(**defaults) def get_prep_lookup(self, lookup_type, value): # data is stored internally as integer so searching as string # yield 0 result. for example: useful for search in admin. if lookup_type in ('exact', 'iexact', 'icontains', 'icontains'): try: return self.get_prep_value(value) except AddrFormatError: return None elif lookup_type in ('in'): try: macs = [] for mac in value: macs += [self.get_prep_value(mac)] return macs except AddrFormatError: return None else: raise TypeError('Lookup type %r not supported.' % lookup_type) ././@PaxHeader0000000000000000000000000000002600000000000011453 xustar000000000000000022 mtime=1620583570.0 django-macaddress-1.8.0/macaddress/formfields.py0000664000175000017500000000151500000000000021427 0ustar00kra3kra300000000000000from django.core.validators import EMPTY_VALUES from django.forms import Field from django.forms.utils import ValidationError from django.utils.translation import gettext_lazy as _ from netaddr import EUI, AddrFormatError class MACAddressField(Field): default_error_messages = { 'invalid': _('Enter a valid MAC Address.'), } def clean(self, value): """ Validates that EUI() can be called on the input. Returns the result of EUI(). Returns None for empty values. """ value = super(MACAddressField, self).clean(value) if value in EMPTY_VALUES: return None try: value = EUI(str(value), version=48) except (ValueError, TypeError, AddrFormatError): raise ValidationError(self.error_messages['invalid']) return value ././@PaxHeader0000000000000000000000000000002600000000000011453 xustar000000000000000022 mtime=1598800097.0 django-macaddress-1.8.0/macaddress/models.py0000664000175000017500000000004600000000000020556 0ustar00kra3kra300000000000000# This file intentionally left blank. ././@PaxHeader0000000000000000000000000000003300000000000011451 xustar000000000000000027 mtime=1620584586.402187 django-macaddress-1.8.0/macaddress/tests/0000775000175000017500000000000000000000000020063 5ustar00kra3kra300000000000000././@PaxHeader0000000000000000000000000000002600000000000011453 xustar000000000000000022 mtime=1598800097.0 django-macaddress-1.8.0/macaddress/tests/__init__.py0000664000175000017500000000000000000000000022162 0ustar00kra3kra300000000000000././@PaxHeader0000000000000000000000000000002600000000000011453 xustar000000000000000022 mtime=1598800097.0 django-macaddress-1.8.0/macaddress/tests/models.py0000664000175000017500000000034200000000000021717 0ustar00kra3kra300000000000000""" A model for testing """ from django.db import models from macaddress.fields import MACAddressField class NetworkThingy(models.Model): mac = MACAddressField() def __unicode__(self): return "%s" % self.mac ././@PaxHeader0000000000000000000000000000002600000000000011453 xustar000000000000000022 mtime=1598800097.0 django-macaddress-1.8.0/macaddress/tests/test_fields.py0000664000175000017500000000160500000000000022744 0ustar00kra3kra300000000000000from django.core.exceptions import ValidationError from django.test import TestCase from django.db import transaction from netaddr.core import AddrFormatError from .models import NetworkThingy class MACAddressFieldTestCase(TestCase): def test_insert_valid_macaddress(self): mac_example = '00:11:22:33:44:aa' x = NetworkThingy(mac=mac_example) x.save() qm = NetworkThingy.objects self.assertEquals(x.mac, mac_example) self.assertEquals(qm.get(mac=mac_example).mac, mac_example) self.assertEquals(qm.all().count(), 1) def test_insert_invalid_macaddress(self): invalid_mac = 'XX' with transaction.atomic(): x = NetworkThingy() with self.assertRaises(ValidationError): x.mac = invalid_mac x.save() self.assertEquals(NetworkThingy.objects.all().count(), 0) ././@PaxHeader0000000000000000000000000000003300000000000011451 xustar000000000000000027 mtime=1620584586.402187 django-macaddress-1.8.0/setup.cfg0000664000175000017500000000010300000000000016426 0ustar00kra3kra300000000000000[bdist_wheel] universal = 1 [egg_info] tag_build = tag_date = 0 ././@PaxHeader0000000000000000000000000000002600000000000011453 xustar000000000000000022 mtime=1620584564.0 django-macaddress-1.8.0/setup.py0000664000175000017500000000246700000000000016336 0ustar00kra3kra300000000000000import os from setuptools import setup, find_packages version = "1.8.0" def read(fname): return open(os.path.join(os.path.dirname(__file__), fname)).read() setup( name="django-macaddress", version=version, url='http://github.com/tubaman/django-macaddress', license='BSD', description="MAC address model and form fields for Django apps.", long_description=read('README.rst'), author='Ryan Nowakowski', author_email='tubaman@fattuba.com', maintainer='Arun Karunagath', maintainer_email='the1.arun@gmail.com', packages=['macaddress', 'macaddress.tests'], install_requires=['netaddr'], tests_require=['Django'], test_suite="runtests.runtests", classifiers=[ 'Development Status :: 5 - Production/Stable', 'Framework :: Django', 'Intended Audience :: Developers', 'License :: OSI Approved :: BSD License', 'Operating System :: OS Independent', 'Programming Language :: Python', 'Programming Language :: Python :: 3', 'Programming Language :: Python :: 3 :: Only', 'Programming Language :: Python :: 3.5', 'Programming Language :: Python :: 3.6', 'Programming Language :: Python :: 3.7', 'Programming Language :: Python :: 3.8', 'Topic :: Internet :: WWW/HTTP', ] )