毕业设计:图书管理系统+可视化+Django框架(源码+论文)✅

毕业设计:2023-2024年计算机专业毕业设计选题汇总(建议收藏)

毕业设计:2023-2024年最新最全计算机专业毕设选题推荐汇总

感兴趣的可以先收藏起来,点赞、关注不迷路,大家在毕设选题,项目以及论文编写等相关问题都可以给我留言咨询,希望帮助同学们顺利毕业 。

1、项目介绍

技术栈:
Python语言、Django框架、Highcharts可视化、MySQL数据库、HTML

本论文所研究的课题是以 Django为基础,设计并实现了一个以 Python为核心的图书管理系统,其中的程序采用了Django中的Web框架,而数据库则采用了 Django中的 SQlite。本系统在设计上简易、直观,方便用户进行使用,除了图书管理方面,还可以对书籍等信息进行数据可视化功能。
基于上述技术,本系统满足实际生活中的图书管理系统的功能需求。本系统主要实现了登录、主页、借书、借阅记录、书籍、书籍类别、出版者、会员、个人中心等功能,主要设计登录模块、菜单模块、借阅模块、图书管理模块、个人中心模块这几大模块。经测试,本系统运行状态良好,基本上满足开发需求。

2、项目界面

(1)图书数据可视化分析

毕业设计:图书管理系统+可视化+Django框架(源码+论文)✅_第1张图片

(2)图书借阅概况

毕业设计:图书管理系统+可视化+Django框架(源码+论文)✅_第2张图片

(3)最近事件

毕业设计:图书管理系统+可视化+Django框架(源码+论文)✅_第3张图片

(4)借阅记录

毕业设计:图书管理系统+可视化+Django框架(源码+论文)✅_第4张图片

(5)图书管理

毕业设计:图书管理系统+可视化+Django框架(源码+论文)✅_第5张图片

(6)会员权限管理

毕业设计:图书管理系统+可视化+Django框架(源码+论文)✅_第6张图片

(7)注册登录界面

毕业设计:图书管理系统+可视化+Django框架(源码+论文)✅_第7张图片

(8)后台数据管理

毕业设计:图书管理系统+可视化+Django框架(源码+论文)✅_第8张图片

3、项目说明

随着当前科学技术的发展,人类对于知识的需求日益增大,图书馆就成为人类获取知识的重要场所,而开发一个图书管理系统对图书进行管理的需求随之增大。
本论文所研究的课题是以 Django为基础,设计并实现了一个以 Python为核心的图书管理系统,其中的程序采用了Django中的Web框架,而数据库则采用了 Django中的 SQlite。本系统在设计上简易、直观,方便用户进行使用,除了图书管理方面,还可以对书籍等信息进行数据可视化功能。
基于上述技术,本系统满足实际生活中的图书管理系统的功能需求。本系统主要实现了登录、主页、借书、借阅记录、书籍、书籍类别、出版者、会员、个人中心等功能,主要设计登录模块、菜单模块、借阅模块、图书管理模块、个人中心模块这几大模块。经测试,本系统运行状态良好,基本上满足开发需求。
文章的结尾部分,对全文所做的工作做了一个小结,并提出了今后的工作方向。
关键词: Django;Python;图书管理系统

毕业设计:图书管理系统+可视化+Django框架(源码+论文)✅_第9张图片

4、核心代码



# HomePage

class HomeView(LoginRequiredMixin,TemplateView):
    login_url = 'login'
    template_name = "index.html"
    context={}

  
    # users = User.objects.all()
    # for user in users:
    #     print(user.get_username(),user.is_superuser)

    def get(self,request, *args, **kwargs):

        book_count = Book.objects.aggregate(Sum('quantity'))['quantity__sum']
        
        data_count = {"book":book_count,
                    "member":Member.objects.all().count(),
                    "category":Category.objects.all().count(),
                    "publisher":Publisher.objects.all().count(),}

        user_activities= UserActivity.objects.order_by("-created_at")[:5]
        user_avatar = { e.created_by:Profile.objects.get(user__username=e.created_by).profile_pic.url for e in user_activities}
        short_inventory =Book.objects.order_by('quantity')[:5]
        
        current_week = date.today().isocalendar()[1]
        new_members = Member.objects.order_by('-created_at')[:5]
        new_members_thisweek = Member.objects.filter(created_at__week=current_week).count()
        lent_books_thisweek = BorrowRecord.objects.filter(created_at__week=current_week).count()

        books_return_thisweek = BorrowRecord.objects.filter(end_day__week=current_week)
        number_books_return_thisweek = books_return_thisweek.count()
        new_closed_records = BorrowRecord.objects.filter(open_or_close=1).order_by('-closed_at')[:5]

        self.context['data_count']=data_count
        self.context['recent_user_activities']=user_activities
        self.context['user_avatar']=user_avatar
        self.context['short_inventory']=short_inventory
        self.context['new_members']=new_members
        self.context['new_members_thisweek']=new_members_thisweek
        self.context['lent_books_thisweek']=lent_books_thisweek
        self.context['books_return_thisweek']=books_return_thisweek
        self.context['number_books_return_thisweek']=number_books_return_thisweek
        self.context['new_closed_records']=new_closed_records
 
        return render(request, self.template_name, self.context)

# Global Serch
@login_required(login_url='login')
def global_serach(request):
    search_value = request.POST.get('global_search')
    if search_value =='':
        return HttpResponseRedirect("/")

    r_category = Category.objects.filter(Q(name__icontains=search_value))
    r_publisher = Publisher.objects.filter(Q(name__icontains=search_value)|Q(contact__icontains=search_value))
    r_book = Book.objects.filter(Q(author__icontains=search_value)|Q(title__icontains=search_value))
    r_member = Member.objects.filter(Q(name__icontains=search_value)|Q(card_number__icontains=search_value)|Q(phone_number__icontains=search_value))
    r_borrow = BorrowRecord.objects.filter(Q(borrower__icontains=search_value)|Q(borrower_card__icontains=search_value)|Q(book__icontains=search_value))

   
    context={
        'categories':r_category,
        'publishers':r_publisher,
        'books':r_book,
        'members':r_member,
        'records':r_borrow,
    }

    return render(request, 'book/global_search.html',context=context)


# Chart
class ChartView(LoginRequiredMixin,TemplateView):
    template_name = "book/charts.html"
    login_url = 'login'
    context={}

    def get(self,request, *args, **kwargs):

        top_5_book= Book.objects.order_by('-quantity')[:5].values_list('title','quantity')
        top_5_book_titles = [b[0] for b in top_5_book ]
        top_5_book__quantities = [b[1] for b in top_5_book ]
        # print(top_5_book_titles,top_5_book__quantities)

        top_borrow = Book.objects.order_by('-total_borrow_times')[:5].values_list('title','total_borrow_times')
        top_borrow_titles = [b[0] for b in top_borrow ]
        top_borrow_times = [b[1] for b in top_borrow ]

        r_open = BorrowRecord.objects.filter(open_or_close=0).count()
        r_close = BorrowRecord.objects.filter(open_or_close=1).count()
        
        m = Member.objects.annotate(month=TruncMonth('created_at')).values('month').annotate(c=Count('id'))
        months_member = [e['month'].strftime("%m/%Y") for e  in m]
        count_monthly_member= [e['c'] for e in m] 

       
        self.context['top_5_book_titles']=top_5_book_titles
        self.context['top_5_book__quantities']=top_5_book__quantities
        self.context['top_borrow_titles']=top_borrow_titles
        self.context['top_borrow_times']=top_borrow_times
        self.context['r_open']=r_open
        self.context['r_close']=r_close
        self.context['months_member']=months_member
        self.context['count_monthly_member']=count_monthly_member
       

        return render(request, self.template_name, self.context)


class BookUpdateView(LoginRequiredMixin,UpdateView):
    model = Book
    login_url = 'login'
    form_class=BookCreateEditForm
    template_name = 'book/book_update.html'

    def post(self, request, *args, **kwargs):
        current_book = self.get_object()
        current_book.updated_by=self.request.user.username
        current_book.save(update_fields=['updated_by'])
        UserActivity.objects.create(created_by=self.request.user.username,
            operation_type="warning",
            target_model=self.model.__name__,
            detail =f"Update {self.model.__name__} << {current_book.title} >>")
        return super(BookUpdateView, self).post(request, *args, **kwargs)

    def form_valid(self, form):
      title=form.cleaned_data['title']      
      messages.warning(self.request, f"Update << {title} >> success")
      return super().form_valid(form)

class BookDeleteView(LoginRequiredMixin,View):
    login_url = 'login'
    def get(self,request,*args,**kwargs):
        book_pk=kwargs["pk"]
        delete_book=Book.objects.get(pk=book_pk)
        model_name = delete_book.__class__.__name__
        messages.error(request, f"Book << {delete_book.title} >> Removed")
        delete_book.delete()
        UserActivity.objects.create(created_by=self.request.user.username,
            operation_type="danger",
            target_model=model_name,
            detail =f"Delete {model_name} << {delete_book.title} >>")
        return HttpResponseRedirect(reverse("book_list"))

# Categorty

class CategoryListView(LoginRequiredMixin,ListView):
    login_url = 'login'
    model=Category
    context_object_name = 'categories'
    template_name = 'book/category_list.html'
    count_total = 0
    search_value = ''
    order_field="-created_at"


    def get_queryset(self):
        search =self.request.GET.get("search")  
        order_by=self.request.GET.get("orderby")
        if order_by:
            all_categories = Category.objects.all().order_by(order_by)
            self.order_field=order_by
        else:
            all_categories = Category.objects.all().order_by(self.order_field)
        if search:
            all_categories = all_categories.filter(
                Q(name__icontains=search)  
            )
            self.search_value=search

        self.count_total = all_categories.count()
        paginator = Paginator(all_categories, PAGINATOR_NUMBER)
        page = self.request.GET.get('page')
        categories = paginator.get_page(page)
        return categories

    def get_context_data(self, *args, **kwargs):
        context = super(CategoryListView, self).get_context_data(*args, **kwargs)
        context['count_total'] = self.count_total
        context['search'] = self.search_value
        context['orderby'] = self.order_field
        context['objects'] = self.get_queryset()
        return context

class CategoryCreateView(LoginRequiredMixin,CreateView):
    login_url = 'login'
    model=Category
    fields=['name']
    template_name='book/category_create.html'
    success_url = reverse_lazy('category_list')

    def form_valid(self, form):
        new_cat = form.save(commit=False)
        new_cat.save()
        send_notification(self.request.user,new_cat,verb=f'Add New Category << {new_cat.name} >>')
        logger.info(f'{self.request.user} created Category {new_cat.name}')
        UserActivity.objects.create(created_by=self.request.user.username,
                                    target_model=self.model.__name__,
                                    detail =f"Create {self.model.__name__} << {new_cat.name} >>")
        return super(CategoryCreateView, self).form_valid(form)



class CategoryDeleteView(LoginRequiredMixin,View):
    login_url = 'login'

    def get(self,request,*args,**kwargs):
        cat_pk=kwargs["pk"]
        delete_cat=Category.objects.get(pk=cat_pk)
        model_name = delete_cat.__class__.__name__
        messages.error(request, f"Category << {delete_cat.name} >> Removed")
        delete_cat.delete()
        send_notification(self.request.user,delete_cat,verb=f'Delete Category << {delete_cat.name} >>')
        UserActivity.objects.create(created_by=self.request.user.username,
                            operation_type="danger",
                            target_model=model_name,
                            detail =f"Delete {model_name} << {delete_cat.name} >>")

        logger.info(f'{self.request.user} delete Category {delete_cat.name}')

        return HttpResponseRedirect(reverse("category_list"))


# Publisher 

class PublisherListView(LoginRequiredMixin,ListView):
    login_url = 'login'
    model=Publisher
    context_object_name = 'publishers'
    template_name = 'book/publisher_list.html'
    count_total = 0
    search_value = ''
    order_field="-created_at"

    def get_queryset(self):
        search =self.request.GET.get("search")  
        order_by=self.request.GET.get("orderby")
        if order_by:
            all_publishers = Publisher.objects.all().order_by(order_by)
            self.order_field=order_by
        else:
            all_publishers = Publisher.objects.all().order_by(self.order_field)
        if search:
            all_publishers = all_publishers.filter(
                Q(name__icontains=search) | Q(city__icontains=search) | Q(contact__icontains=search)
            )
        else:
            search = ''
        self.search_value=search
        self.count_total = all_publishers.count()
        paginator = Paginator(all_publishers, PAGINATOR_NUMBER)
        page = self.request.GET.get('page')
        publishers = paginator.get_page(page)
        return publishers

    def get_context_data(self, *args, **kwargs):
        context = super(PublisherListView, self).get_context_data(*args, **kwargs)
        context['count_total'] = self.count_total
        context['search'] = self.search_value
        context['orderby'] = self.order_field  
        context['objects'] = self.get_queryset()      
        return context





5、源码获取方式

由于篇幅限制,获取完整文章或源码、代做项目的,查看我的【用户名】、【专栏名称】、【顶部选题链接】就可以找到我啦

感兴趣的可以先收藏起来,点赞、关注不迷路,下方查看获取联系方式

你可能感兴趣的:(biyesheji0002,毕业设计,biyesheji0001,课程设计,django,python,大数据,毕业设计,机器学习,图书)