These are chat archives for django/django

Sep 2017
Sep 19 2017 04:40 UTC
@oguzhan-yilmaz Thanks. I just put in the first migration file. That's fine
In my model schema. I have created_user, and updated_user
And I would like to to log the DjangoAdmin user from doing change in the record.
What topic I should start?
Sep 19 2017 09:59 UTC
Hi, I'm trying to use a password to generate a RSA keypair. I have the three fields in my model but in my form i only have a field for the password. In that case i use the view to crunch the numbers and save the computed keys?
Sep 19 2017 10:05 UTC
I also wonder if the fields that are not in the form should have a blank=true so that the view could save each element one after the other?
maybe not just check them all and then save the lot ?
Milan Leon
Sep 19 2017 12:05 UTC
Does anyone have worked with payment gateway Banwire and API integration ? Thanks a lot
Kaushal Kumar
Sep 19 2017 13:42 UTC
I have to validate django request. For that I am using
It works fine if I use decorator like
class CouponCreate(APIView):
    @use_args(coupon_args, locations=('json', 'form'))
    def post(self, request):
but I am not able to catch its error
So I am using another method
from django.http import JsonResponse

from webargs import fields, ValidationError

argmap = {
    'name': fields.Str(required=True)
def index(request):
        args = parser.parse(argmap, request)
    except ValidationError as err:
        return JsonResponse(err.messages, status=err.status_code)
    return JsonResponse({'message': 'Hello {name}'.format(name=name)})
Kaushal Kumar
Sep 19 2017 13:49 UTC
But now the error is
raise RawPostDataException("You cannot access body after reading from request's data stream")
How can I fix this error?
Please help
Sathish Kumar
Sep 19 2017 13:50 UTC
what type of validation
Kaushal Kumar
Sep 19 2017 13:57 UTC
Request validation
got resolved
Sathish Kumar
Sep 19 2017 13:57 UTC
Kaushal Kumar
Sep 19 2017 13:58 UTC
args = parser.parse(argmap, request, locations=('json', 'form'))

Hi I have created Form field for HomePage like this

class HomePageFormField(AbstractFormField):
    page = ParentalKey('home.HomePage', related_name='form_fields')

class HomePage(MetadataPageMixin, Page):
    body = StreamField(RiderStreamBlock())
    search_fields = Page.search_fields + [

    api_fields = ['body', 'carousel_items']

    class Meta:
        verbose_name = "Homepage"

HomePage.content_panels = [
    FieldPanel('title', classname="full title"),
    InlinePanel('carousel_items', label="Carousel items"),
    InlinePanel('form_fields', label="Newsletter Form")


HomePage.promote_panels = Page.promote_panels

And rendering like this at home_page.html

<form class="validate" action="{% pageurl page %}" method="post" data-success="Subscribed! Thank you!" data-toastr-position="bottom-right">
                                        {% csrf_token %}    
                                        {% for field in form %}
                                        <div class="input-group">
                                            <span class="input-group-addon"><i class="fa fa-envelope"></i></span>
                                            {{ field|add_class:"form-control required" }}   <span class="input-group-btn">
                         <button class="btn btn-black" type="submit">Subscribe</button>
        {% endfor %}

But not rendering or showing on page. Could you please anyone tell me what can be causing that issue?