Metadata-Version: 1.2
Name: django-parser-app
Version: 0.0.3
Summary: A Django app to upload XL files in a convenient manner.
Home-page: https://www.github.com/prantoamt/django-parser-app
Author: Md. Badiuzzaman Pranto
Author-email: prantoamt@gmail.com
License: MIT License
Description: django-parser-app
        =================
        
        parser\_app has been created intending to upload Excel files in a
        convenient manner. This is a rest\_framework based packege and is
        usuable in many projects.
        
        Detailed documentation is in the "docs" directory.
        
        Quick start
        -----------
        
        1. Install django-parser-app ``pip install django-parser-app``
        
        2. Add ``parser_app`` and it's dependencies to your ``INSTALLED_APPS``
           setting like this::
           ``INSTALLED_APPS = [         ...         'parser_app',         'rest_framework',         'corsheaders',     ]``
        3. Add SITE\_URL in setting:: ``SITE_URL = 'http://yoursiteurl.com'``
        
        4. Implement Django Dependancy Settings:
        
           -  `Django Rest Framework <http://www.django-rest-framework.org/>`__
           -  `Django Cors
              Headers <https://github.com/ottoyiu/django-cors-headers>`__
        
           Such as:
        
           ::
        
               MIDDLEWARE = [
                   ...
                   'django.contrib.sessions.middleware.SessionMiddleware',
                   'corsheaders.middleware.CorsMiddleware',
                   'django.middleware.common.CommonMiddleware',
                   ...
               ]
        
               REST_FRAMEWORK = {
                   'DEFAULT_PERMISSION_CLASSES': (
                       'rest_framework.permissions.IsAuthenticated',
                       'rest_framework.permissions.IsAuthenticatedOrReadOnly',
                   ),
                   'DEFAULT_AUTHENTICATION_CLASSES': (
                       'rest_framework.authentication.SessionAuthentication',
                   ),
               }
        
               CORS_ORIGIN_ALLOW_ALL = True
        
        5. parser\_app is a api based packege. Include it's URLconf in your
           project urls.py exactly like this::
           ``path('api/', include('parser_app.urls')),``
        
        6. Run ``python manage.py migrate`` to create the parser\_app models.
        
        7. Register your models which your want to import data using Excel files
           in ``admin.py`` file. A demo model and it's admin.py file is given
           below:: #### models.py \`\`\` class Area(models.Model): code =
           models.IntegerField( null=False, blank=False, unique=True,
           verbose\_name="Location Code", db\_column='Code', default=0) name =
           models.CharField(null=False, blank=False, max\_length=50,
           db\_column='Name', default='') location\_type = models.CharField(
           choices=LOCATION\_TYPE, default='', max\_length=20,
           verbose\_name="Location type", db\_column='LocationType')
           parent\_code = models.IntegerField(null=True, blank=True, default=0,
           verbose\_name="Parent Code", db\_column='ParentCode') class Meta:
           verbose\_name\_plural = "Area"
        
           ::
        
               def __str__(self):
                   return str(self.code)
        
           ::
        
               #### admin.py
        
           from django.contrib import admin
           from .models import Area from parser\_app.parser import DataParser
        
           DataParser.register\_model(Area) \`\`\`
        
        8. Start the development server
           ``python manage.py runserver 0.0.0.0:8000`` and visit
           http://127.0.0.1:8000/admin/. After login, you will see a new model
           named ``RegisteredModels``. All your registered models will be listed
           here.
        
        Import data to Area model through Django admin panel
        ----------------------------------------------------
        
        .. figure:: https://github.com/prantoamt/django-parser-app/blob/main/images/upload_via_admin_panel.gif
           :alt: Alt Text
        
           Alt Text
        
        1.  Click on the ``Registred Models`` that is located inside
            ``parser_app`` section.
        2.  You will see the ``Area`` model listed there.
        3.  Select the check box and then click on the django admin action
            panel.
        4.  Select ``import with parser app`` and click on ``go``.
        5.  Select your desired Excel file and submit.
        6.  In the next step, you will be given the model's columns and the
            columns available in the Excel file.
        7.  Map the columns to specify which column of the Excel file means
            which column of the Model and then submit.
        8.  You will the shown the estimated data type validation errors in the
            next step. For example, your model field accept ``int`` value but
            your file contains ``string``.
        9.  If no validation errors are found, you will be asked to confirm
            upload.
        10. After confirmation, your data wil be imported in the desired model
            (in case of this example, ``Area`` model).
        
        \*\*Feel free to participate in the parser\_app. I appreciate your
        contributions!
        
Platform: UNKNOWN
Classifier: Environment :: Web Environment
Classifier: Framework :: Django
Classifier: Framework :: Django :: 3.2
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: MIT 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.6
Classifier: Programming Language :: Python :: 3.7
Classifier: Programming Language :: Python :: 3.8
Classifier: Topic :: Internet :: WWW/HTTP
Classifier: Topic :: Internet :: WWW/HTTP :: Dynamic Content
Requires-Python: >=3.6
