I am doing a simple form site with Django. This is what my sites url is looks like: mysite.com/register/12345678 I want to print the part after the register (12345678) to the order id field. When someone goes this mysite.com/register/87654321 url then i want to print it. How can i do that? These are my codes.(Currently using Django 1.11.10)
forms.py
from django import forms
from .models import Customer
from . import views
class CustomerForm(forms.ModelForm):
    class Meta:
        model = Customer
        fields = (
        'order_id','full_name','company','email',
        'phone_number','note')
        widgets = {
            'order_id': forms.TextInput(attrs={'class':'orderidcls'}),
            'full_name': forms.TextInput(attrs={'class':'fullnamecls'}),
            'company': forms.TextInput(attrs={'class':'companycls'}),
            'email': forms.TextInput(attrs={'class':'emailcls'}),
            'phone_number': forms.TextInput(attrs={'class':'pncls'}),
            'note': forms.Textarea(attrs={'class':'notecls'}),
        }
views.py
from django.shortcuts import render
from olvapp.models import Customer
from olvapp.forms import CustomerForm
from django.views.generic import CreateView,TemplateView
def guaform(request,pk):
    form = CustomerForm()
    if request.method == "POST":
        form = CustomerForm(request.POST)
        if form.is_valid():
            form.save(commit=True)
        else:
            print('ERROR FORM INVALID')
    theurl = request.get_full_path()
    orderid = theurl[10:]
    return render(request,'forms.py',{'form':form,'orderid':orderid})
customer_form.html
{% extends 'base.html' %}
{% block content %}
<h1>REGİSTRATİON</h1>
<form class="registclass" method="POST">
  {% csrf_token %}
  {{ form.as_p }}
  <button type="submit" class="btn btn-default">REGISTER</button>
</form>
{% endblock %}
urls.py
from django.conf.urls import url
from django.contrib import admin
from olvapp import views
urlpatterns = [
    url(r'^admin/', admin.site.urls),
    url(r'^thanks/$',views.ThankView.as_view(),name='thank'),
    url(r'^register/(?P<pk>\d+)',views.guaform,name='custform'),
]
 
     
    