text: from django import forms
  from django.contrib.auth.models import User
  from .models import Page, Category, UserProfile
  
  
  class CategoryForm(forms.ModelForm):
      name = forms.CharField(max_length=128, help_text="Please enter the category name.")
      views = forms.IntegerField(widget=forms.HiddenInput(), initial=0)
      likes = forms.IntegerField(widget=forms.HiddenInput(), initial=0)
  
      class Meta:
          model = Category
  
  
  class PageForm(forms.ModelForm):
      title = forms.CharField(max_length=128, help_text="Please enter the title of the page.")
      url = forms.URLField(max_length=200, help_text="Please enter the URL of the page.")
      views = forms.IntegerField(widget=forms.HiddenInput(), initial=0)
  
      def clean(self):
          cleaned_data = self.cleaned_data
          url = cleaned_data.get('url')
  
          if url and not url.startswith('http://'):
              url = 'http://' + url
  
              cleaned_data['url'] = url
          return cleaned_data
  
      class Meta:
          model = Page
          fields = ('title', 'url','views')
  
  class UserForm(forms.ModelForm):
      username = forms.CharField(help_text="Please enter a username.")
      email = forms.CharField(help_text="Please enter your email.")
      password = forms.CharField(widget=forms.PasswordInput(), help_text="Please enter a password.")
  
      class Meta:
          model = User
          fields = ('username', 'email', 'password')
  
  class UserProfileForm(forms.ModelForm):
      website = forms.URLField(required=False, help_text="Enter a website.")
      picture = forms.ImageField(required=False, help_text="Set a profile picture.")
      class Meta:
          model = UserProfile
          fields = ['website', 'picture']
  