Mujocso

A library for return and display excellent and responsive static pages in Django


Keywords
Django, Page, Render, Views, Static, library, pages, python, responsive
License
MIT
Install
pip install Mujocso==0.6

Documentation


Mujocso Logo


Components

About

Mujocso is a python library for return and display excellent and responsive static pages in Django views. You can use Mujocso to create and display error pages, 404 pages, coming soon pages, updating pages, etc.

  • Simple
  • Customizable
  • powerful
  • Has customizable styles and pages

Install and Use

To install Mujocso, simply use the pip in your CMD or terminal

pip install Mujocso

Then in views.py, just import the Mujocso class from Mujocso!

  import Mujocso

Example Usage

In Mujocso, you can return pages in one view using render

In render, you can set all the elements to be displayed on the page. You can define tags in the headers parameter

Example

  <!DOCTYPE html>
  <html lang='en'>
  <head>
      <meta charset='UTF-8'>
      <meta name='viewport' content='width=device-width, initial-scale=1.0'>
      <title>Mujocso Page</title>
  </head>
  <body>
      <h1>Hello, Mujocso!</h1>
      <h2>This is a test</h2>
  </body>
  </html>

For example, if you want to return the this simple page to the user using Mujocso in a django view, you can use the following code :

def DjangoView(request):
    return Mujocso.render(headers=[
        {
            'size':1,
            'value': 'Hello, Mujocso!'
        },
        {
            'size':2,
            'value': 'This is a test'
        },
    ], page_title='Mujocso Page')

Preview

Mujocso

Note : The page_title value is on 'Mujocso Page' by default

Class & Id

To set a class or ID for a header, simply add the value of the class or ID to an header object. You can use id or class in page styles.

def DjangoView(request):
    return Mujocso.render(headers=[
        {
            'size':1,
            'value': 'Hello, Mujocso!',
            'id':'header1_id'
        },
        {
            'size':2,
            'value': 'This is a test',
            'class':'header2_class'
        },
    ], page_title='Mujocso Page')

Styles

You can use the 'style' value to set the style for a header Mujocso has several ready-made styles and you can use them. You can also manually style the header yourself.

Use only one style

To use only one style, you can enter the style as a string.

def DjangoView(request):
    return Mujocso.render(headers=[
        {
            'size':1,
            'value': 'Hello, Mujocso!',
            'style':'text-align: center'
        },
        {
            'size':2,
            'value': 'This is a test'
        },
    ], page_title='Mujocso Page')

Preview

Mujocso

But if you want to give multiple styles to one header, you can use a list and put each style in a value of the list

def DjangoView(request):
    return Mujocso.render(headers=[
        {
            'size':1,
            'value': 'Hello, Mujocso!',
            'style':[
                'text-align: center',
                'background-color: red',
                'font-size: 20px',
                ...
            ]
        },
        {
            'size':2,
            'value': 'This is a test'
        },
    ], page_title='Mujocso Page')

Preview

Mujocso

To use predefined Mujocso styles, just enter the name of the defined style in the style value. You can waste your own styles among several styles or you can use several Mujocso styles at the same time.

Click here to see a list of Mujocso styles for the elements

For example, we want to use one of Mujocso's ready-made styles, called CBRORANGE

def DjangoView(request):
    return Mujocso.render(headers=[
        {
            'size':1,
            'value': 'Hello, Mujocso!',
            'style':'CBRORANGE'
        },
        {
            'size':2,
            'value': 'This is a test'
        },
    ], page_title='Mujocso Page')

Preview

Mujocso

You can also use your own styles along with Mujocso styles.

def DjangoView(request):
    return Mujocso.render(headers=[
        {
            'size':1,
            'value': 'Hello, Mujocso!',
            'style':[
                'CBRORANGE',
                'text-align: center',
                'font-size: 60px',
                ...
            ]
        },
        {
            'size':2,
            'value': 'This is a test'
        },
    ], page_title='Mujocso Page')

Preview

Mujocso

Set the style for the page

You can also put your own styles on a Mojoksu page. You can use the amount of style in the rendering to record your own styles. Style value type must be a list

def DjangoView(request):
    return Mujocso.render(headers=[
        {
            'size':1,
            'value': 'Hello, Mujocso!',
            'style':[
                'CBRORANGE',
                'text-align: center',
                'font-size: 60px'
            ]
        }
    ], page_title='Mujocso Page', style=['body{ background-color: black }'])

Preview

Mujocso

Using a Script

You can add js scripts to the page. To add script to the page, just use the script in the render(). Also note that the script value format must be a list!

def DjangoView(request):
    return Mujocso.render(headers=[
        {
            'size':1,
            'value': 'Hello, Mujocso!'
        },
        {
            'size':2,
            'value': 'This is a test'
        },
    ], script=[
        'alert(\'hello\');'
    ], page_title='Mujocso Page')

Add some script from URL

If you have a script that you want to get from a specific URL and add it to your page, you can use "using"

Eden scripts should be in the form of a list. Each value must be typed to a string.

def DjangoView(request):
    return Mujocso.render(using=[
        'https://code.jquery.com/jquery-3.5.1.js',
        'https://cdn.jsdelivr.net/npm/bootstrap@5.0.0-beta1/dist/js/bootstrap.bundle.min.js',
        ...
    ], page_title='Mujocso Page')

Using a Template

Mujocso has templates by default that you can use. Templates are actually pre-made CSS that you just need to insert headers and elements into the render.

Click here to see a list of Mujocso templates for the pages

In this example, we want to use the CBRO404 template

def DjangoView(request):
    return Mujocso.render(headers=[
        {
            'size':1,
            'value': 'Mujocso',
        },
        {
            'size':2,
            'value':'This is a test page using Mujocso'
        },
        {
            'size':3,
            'value':'Mujocso is a library for return static pages in Django views.'
        }
    ], page_title='Mujocso Page', template='CBRO404')

Preview

Mujocso

Add some Element

You can add other elements to your page. (Elements such as p, a, img and...)

To add these elements, you must use the value of elements. Type the amount of elements should be in a list and its components (elements) should be in the form of a dictionary.

Each element has two essential values of 'type' and 'value'. In the 'type' value, the type of element is placed. (p, a, and...)

For example, let's make an '< p >' tag.

def DjangoView(request):
    return Mujocso.render(elements=[
        {
            'type':'p',
            'value': 'Hello Mujocso!',
        },
    ], page_title='Mujocso Page')

This is a simple foundation tag. You can add other values to your element by entering other values.

(Example)

def DjangoView(request):
    return Mujocso.render(elements=[
        {
            'type':'p',
            'value': 'Hello Mujocso!',
            'onclick':'Test()',
            'id':'ElementId',
            'class':'ElementClass',
            ...
        },
    ], page_title='Mujocso Page')

Now let's make an '< a >' tag

def DjangoView(request):
    return Mujocso.render(elements=[
        {
            'type':'a',
            'value': 'Click Me!',
            'href':'https://github.com/'
        },
    ], page_title='Mujocso Page')

You can easily add the tags you want to add to your page! :)

Mujocso elements Styles

  • CBRORANGE

Mujocso page Templates

  • CBRO404