GithubHelp home page GithubHelp logo

dima-kov / django-croppie Goto Github PK

View Code? Open in Web Editor NEW
25.0 25.0 11.0 41 KB

Django application for croppie.js integration

License: MIT License

Python 67.65% CSS 25.40% JavaScript 4.86% HTML 2.09%
croppie django image-cropping image-processing python python3

django-croppie's People

Contributors

dependabot[bot] avatar dima-kov avatar ngse avatar x0nix avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

django-croppie's Issues

Render croppie again

Hi ! i am using croppie and its working fine. I was trying to add some functionality like clicking on a button gives me the cropped image [working fine] but i also wanted to add a button which takes be back to crop the same uploaded image. is there a way to render croppie again without actually refreshing the page.
ThankYou. ;)

how to set quality?

options={
                'viewport': {'width': 210, 'height': 210, 'type': 'circle'},
                'boundary': {'width': '100%', 'height': 300},
                'showZoomer': True,
                'quality': '.5'
            }

This code can't set quality.

what about default image?

image = models.ImageField(default='default.jpg', upload_to='profile_pics')

as you can see i need to set a default image and the location how to do this with:

photo = CroppieField()

Widget not working with InlineFormSet

I'm trying to use the module with an inlineformset_factory, my settings are as as follow:

models.py

class Products(models.Model):
...

class Product_Image(models.Model):
    product = models.ForeignKey('Products', on_delete=models.CASCADE)
    image = models.ImageField(null=True, upload_to=...)

forms.py

class ProductForm(forms.ModelForm):
   ...

class Product_ImageForm(forms.ModelForm):
    image = CroppieField()
    class Meta:
        model = Product_Image
        fields = '__all__'
        
ProductInlineFormSet = inlineformset_factory(Products, Product_Image,form=Product_ImageForm)

views.py

class NewProductView(LoginRequiredMixin, CreateView):
    model = Products
    form_class = ProductForm
    template_name = 'products/addProduct.html'
    login_url = reverse_lazy('users:login')
    # fields = "__all__"

    def get_context_data(self, **kwargs):
        context = super(NewProductView, self).get_context_data(**kwargs)
        if self.request.POST:
            context['product_formset'] = ProductInlineFormSet(self.request.POST)
        else:
            context['product_formset'] = ProductInlineFormSet()
        return context
    ...

template

...
                       {{product_formset}}
                        <div class="row">
                            <div class='col d-flex flex-row-reverse'>
                                <button class="btn btn-info btn-lg">Salvar</button>
                            <div>
                        </div>
                        <div style="width:50%">
                            <div id="cropper"></div>
                        </div>                        
                    </form>
                    {{ form.media }}
                    {{ product_formset.media }}
...

What I have when I open the page of the create view is a blank widget that wherever I upload an image does not update to crop the current image, like it would happen if it was in a normal form. I tried using a normal form and it worked perfectly but that is not my objective. It would be nice if in the future you added support to formsets and such.
image

Template croppie/widget.html didn't find

I have a exception about django can't find a template - croppie/widget.html

1 | {% spaceless %}{% for widget in widget.subwidgets %}{% include widget.template_name %}****{% endfor %}{% endspaceless %}

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.