Coder Social home page Coder Social logo

Comments (13)

bumblebee211196 avatar bumblebee211196 commented on July 21, 2024 1

Hey @Sibyx I am currently working on other priority work. I will visit this back once I am done with that.

from django_api_forms.

Sibyx avatar Sibyx commented on July 21, 2024 1

Hello @AmberAnsari89, feel free to take the issue. Basically all you need to know is stated in this issue so read it carefully. If you have any questions feel free to ask. Implementation is suppose to happen in the DictionaryField. Validation is executed in the to_python and you can mark validation error by raising DetailValidationError (if you have path to the key in a dictionary) or ValidationError if you have a generic error. Check existing implementation. Feel free to offer a PR so we can discuss the source code in the more practical way. Let me know if you are going to take the issue.

from django_api_forms.

harlansgs avatar harlansgs commented on July 21, 2024

What would constitute an invalid key?

from django_api_forms.

Sibyx avatar Sibyx commented on July 21, 2024

@harlansgs Hi, I am thinking of possibility to do something like this:

Example request

{
  "my_typed_dict": {
    "b061bb03-1eaa-47d0-948f-3ce1f15bf3bb": 2.718,
    "0a8912f0-6c10-4505-bc27-bbb099d2e395": 42
  }
}

Example form

class AlbumForm(Form):
    my_typed_dict = DictionaryField(key_field=fields.UUIDFIeld(), value_field=fields.DecimalField())

I am still undecided if it makes sense to have such a "feature". What do you think?

from django_api_forms.

bumblebee211196 avatar bumblebee211196 commented on July 21, 2024

I would like to work on this.

from django_api_forms.

Sibyx avatar Sibyx commented on July 21, 2024

@bumblebee211196 feel free to take the issue :) If you any questions don't hesitate to ask.

from django_api_forms.

bumblebee211196 avatar bumblebee211196 commented on July 21, 2024

@bumblebee211196 feel free to take the issue :) If you any questions don't hesitate to ask.

Sure!. Let me first collect a list of field types we can provide for the keys and values in the DictionaryField. We shall discuss on what to include and what not to include.

from django_api_forms.

Sibyx avatar Sibyx commented on July 21, 2024

Hi @bumblebee211196, I think it is not necessary to specify allowed fields for dictionary keys and values. I am aware that not all fields are making sense as keys, but enforcing such limitations will be a needless complication. If we want to keep the codebase as simple and as fast as possible we can't do everything for the programmer (checking his logical errors). If you have a different opinion I am here to listen of course :)

from django_api_forms.

AmberAnsari89 avatar AmberAnsari89 commented on July 21, 2024

hi,
i am beginner in python/django..can you help to get a issue to solve at my level?

from django_api_forms.

Vrbitko avatar Vrbitko commented on July 21, 2024

Hello @Sibyx, is this issue still opened and free to take? Can i take it?

from django_api_forms.

AmberAnsari89 avatar AmberAnsari89 commented on July 21, 2024

thank you for your reply.. i ready to take the issue however i am new to open source area. so please help me with guidelines and source code and other details to do my analysis and get better insight.

from django_api_forms.

AmberAnsari89 avatar AmberAnsari89 commented on July 21, 2024

from django_api_forms.

Sibyx avatar Sibyx commented on July 21, 2024

You need to add new parameters to the DictionaryField constructor (check my example in this issue). Then in the to_python method you have to call validation (to_python methods for attributes from the constructor you created).

from django_api_forms.

Related Issues (20)

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.