I Want To Use JSignatureMIxin In Django Model

I Want To Use JSignatureMIxin In the Django Model For Saving The Signature On the Agreement Page.


COde of Models:

from jsignature.mixins import JSignatureFieldsMixin

class JSignatureModel(JSignatureFieldsMixin):
    name = models.CharField(max_length=100)

    def __str__(self):
        return self.name    


class AgreementDetail(models.Model):

    """Agreement Details model for the user agreement management"""

    user = models.ForeignKey(
        CustomUser, on_delete=models.CASCADE, related_name="user_agreement")
    title = models.CharField(max_length=254, null=False, blank=False)
    content = models.TextField(max_length=1024, null=False, blank=False)
    signature = models.ForeignKey(JSignatureModel, on_delete=models.CASCADE, null=False, blank=False)

    def __str__(self) -> str:
        return f"{self.title}"

code of Serializers.py

class JSignatureSerializers(serializers.ModelSerializer):
    class Meta:
        model = JSignatureModel
        fields = '__all__'

If GitHub - fle/django-jsignature: Use jSignature jQuery plugin in your django projects is the package you’re trying to use here, your odds don’t look good.

There hasn’t been a release of this in nearly two years - roughly Django 4.0. It’s clearly not an active and well-maintained project, and you’re trying to run it with Django 5.0. Not only that, but it appears that you may be trying to use it with DRF, and there’s nothing in the docs for it referencing DRF compatibility or functionality.

<conjecture>
You may have some work to do to bring it up-to-date and to make it work.
</conjecture>

Since this is a third-party package - and not a particularly popular or well-known package, your first source of help should probably be with the authors via their repo issues.

I Want To Add the Signature Field Model ANd Use This Model in Serializers In DRF, Tell Me Any Other alternative Of This Field That Fulfill My Need. The Github Link Is Usefull WHen I Deal With Django templates , But In My Case I Do not use Of Template And Forms, I WOrking in DRF

I’m not personally aware of any. This may be one of those situations where you need to develop this yourself. The existing code may be a good starting point, I don’t know.

Ok I Start Searching About This Thanks @KenWhitesell For Your Instant Reply