Welcome!

Join our community of MMO enthusiasts and game developers! By registering, you'll gain access to discussions on the latest developments in MMO server files and collaborate with like-minded individuals. Join us today and unlock the potential of MMO server development!

Join Today!

Django/DRF Refined implementation (API, admin panel, etc)

Newbie Spellweaver
Joined
Jul 11, 2021
Messages
26
Reaction score
9
I forgot to post this when I wrote it a few years ago. It is meant to be used with .

The models were easily generated thanks to



By default, it's expected that your Refined server path is as follows
Python:
'default': {
    'ENGINE': 'django.db.backends.sqlite3',
    # If username is 'Venister', server folder should be at
    # `C:\Users\Venister\Documents\rfgunz\server`
    'NAME': f'C:\\Users\\{os.getlogin()}\\Documents\\rfgunz\\server\\GunzDB.sq3'
}


Endpoints are as follows

Python:
# Admin
path('admin/', admin.site.urls),
# ListView
path("gunz/accounts/list/",               AccountList.as_view(),           name="list"),
path("gunz/characters/list/",             CharacterList.as_view(),         name="list"),
path("gunz/clans/list/",                  ClanList.as_view(),              name="list"),
path("gunz/clans/list/totalpoints/",      ClanListByTotalPoints.as_view(), name="list"),
path("gunz/clans/list/points/",           ClanListByPoints.as_view(),      name="list"),
path("gunz/clans/<int:clan_id>/members/", ClanMemberList.as_view(),        name="list"),
path("gunz/stages/list",                  GameRoomList.as_view(),          name="list"),


# Create
path("gunz/maxoutaccount/",     MaxOutAccount.as_view(), name='create'),
path("gunz/clans/adminaboose/", AdminAbuse.as_view(),    name='create'),
path("gunz/clans/reset/",       ClanReset.as_view(),     name='create'),

Admin panel (Django default)
1705786526107 - Django/DRF Refined implementation (API, admin panel, etc) - RaGEZONE Forums

1705786614838 - Django/DRF Refined implementation (API, admin panel, etc) - RaGEZONE Forums


Some endpoint examples
Character list
1705787242779 - Django/DRF Refined implementation (API, admin panel, etc) - RaGEZONE Forums

Python example of using the
Code:
gunz/maxoutaccount/
to set all characters belonging to
Code:
account_id
to a
Code:
target_level

Note: This also sets bounty to be quite high for each character.

Python:
>>> import requests
>>> r = requests.post("http://localhost:6969/gunz/maxoutaccount/", data={"account_id": 2, "target_level": 99})
>>> r
<Response [200]>
>>>
 

Attachments

You must be registered for see attachments list
Last edited:
Junior Spellweaver
Joined
Oct 28, 2009
Messages
131
Reaction score
63
1. use list display in admin, and use decorator @admin.register
2. use generic views, have more control to api
3. all used typing all request, parameters and response
4. in relations used depth serializers and views, prefetch_related or select_related

some improvements.
 
Back
Top