• This project
    • Loading...
  • Sign in

Marta Miranda / boletin_api

Logo codes
Go to a project
Toggle navigation
  • Projects
  • Groups
  • Snippets
  • Help
Toggle navigation pinning
  • Project
  • Activity
  • Repository
  • Pipelines
  • Graphs
  • Issues 0
  • Merge Requests 0
  • Wiki
  • Network
  • Create a new issue
  • Builds
  • Commits
Merged
Merge Request !22 opened 2023-08-15 11:31:59 UTC by Enzo Yair@Ecardenez

cambios en permisos, sobreescritura del metodo get y serializar comprobante de pago

Edited 2023-08-16 14:19:07 UTC
Request to merge feature/#27_serializar_comprobante_de_pago into develop
×

Check out, review, and merge locally

Step 1. Fetch and check out the branch for this merge request

git fetch origin
git checkout -b feature/#27_serializar_comprobante_de_pago origin/feature/#27_serializar_comprobante_de_pago

Step 2. Review the changes locally

Step 3. Merge the branch and fix any conflicts that come up

git checkout develop
git merge --no-ff feature/#27_serializar_comprobante_de_pago

Step 4. Push the result of the merge to GitLab

git push origin develop

Note that pushing to GitLab requires write access to this repository.

Tip: You can also checkout merge requests locally by following these guidelines

Merged by Enzo Yair 2023-08-16 11:29:43 UTC

The changes were merged into develop. The source branch has been removed.

  • Discussion 3
  • Commits 1
  • Changes 12
  • Enzo Yair
    @Ecardenez 2023-08-16 11:29:43 UTC

    Status changed to merged

  • Enzo Yair
    @Ecardenez 2023-08-16 11:29:43 UTC

    mentioned in commit a50385a6

  • Avatar
    Martín Miranda
    @debianitram started a discussion on the diff 2023-08-16 14:16:26 UTC
    Toggle discussion
    project/apps/edicto/api.py
    cantidad_palabras = contador(edicto)
    serializer.save(cantidad_palabras=cantidad_palabras)
     
    def include_fecha_publicacion(self):
    return self.request.user.is_staff
    def list(self, request, *args, **kwargs):
    queryset = self.filter_queryset(self.get_queryset())
    serializer = self.get_serializer(queryset, many=True)
    for data in serializer.data:
    if self.include_fecha_publicacion():
    • Martín Miranda
      @debianitram commented 2023-08-16 14:16:26 UTC
      Developer

      resolver desde el serializador

  • Avatar
    Martín Miranda
    @debianitram started a discussion on the diff 2023-08-16 14:16:47 UTC
    Toggle discussion
    project/apps/edicto/serializer.py
    user = request.user if request else None
    if not user or user.is_anonymous:
    raise serializers.ValidationError("El usuario debe estar autenticado.")
    if not user.is_staff:
    if not user.es_staff:
    • Martín Miranda
      @debianitram commented 2023-08-16 14:16:47 UTC
      Developer

      Aquí no sería is_staff la propiedad ?

  • Avatar
    Martín Miranda
    @debianitram started a discussion on the diff 2023-08-16 14:19:07 UTC
    Toggle discussion
    project/apps/edicto/serializer.py
    def to_representation(self, instance):
    data = super().to_representation(instance)
    user = self.context['request'].user
    if user.is_staff:
    data['fecha_publicacion'] = instance.fecha_publicacion
    return data
     
    @staticmethod
    def validate_archivo(value):
    filename, extension = value.name.rsplit(".", 1)
    if extension.lower() not in EXTENSIONES_VALIDAS:
    raise serializers.ValidationError("Archivos permitidos: .pdf, .docx, .jpg, .jpeg, .png")
    raise serializers.ValidationError("Archivos permitidos: .pdf, .docx, .jpg, .png")
    • Martín Miranda
      @debianitram commented 2023-08-16 14:19:07 UTC
      Developer

      raise serializers.ValidationError(f"Archivos permitidos: {', '.join(EXTENSIONES_VALIDAS)}")

  • Please register or login to post a comment
Enzo Yair
Assignee
Enzo Yair @Ecardenez
Assign to
None
Milestone
None
Assign milestone
1
1 participant
Reference: mvmiranda/boletin_api!22
×

Revert this merge request

Cancel
A new branch will be created in your fork and a new merge request will be started.
×

Cherry-pick this merge request

Cancel
A new branch will be created in your fork and a new merge request will be started.