CustomFieldRequest

Struct CustomFieldRequest 

Source
pub struct CustomFieldRequest {
Show 22 fields pub object_types: Vec<String>, pub type: RHashType, pub related_object_type: Option<Option<String>>, pub name: String, pub label: Option<String>, pub group_name: Option<String>, pub description: Option<String>, pub required: Option<bool>, pub unique: Option<bool>, pub search_weight: Option<i32>, pub filter_logic: Option<FilterLogic>, pub ui_visible: Option<UiVisible>, pub ui_editable: Option<UiEditable>, pub is_cloneable: Option<bool>, pub default: Option<Option<Value>>, pub related_object_filter: Option<Option<Value>>, pub weight: Option<i32>, pub validation_minimum: Option<Option<f64>>, pub validation_maximum: Option<Option<f64>>, pub validation_regex: Option<String>, pub choice_set: Option<Option<Box<CustomFieldRequestChoiceSet>>>, pub comments: Option<String>,
}
Expand description

CustomFieldRequest : Extends the built-in ModelSerializer to enforce calling full_clean() on a copy of the associated instance during validation. (DRF does not do this by default; see https://github.com/encode/django-rest-framework/issues/3144)

Fields§

§object_types: Vec<String>§type: RHashType
  • text - Text * longtext - Text (long) * integer - Integer * decimal - Decimal * boolean - Boolean (true/false) * date - Date * datetime - Date & time * url - URL * json - JSON * select - Selection * multiselect - Multiple selection * object - Object * multiobject - Multiple objects
§related_object_type: Option<Option<String>>§name: String

Internal field name

§label: Option<String>

Name of the field as displayed to users (if not provided, ’the field’s name will be used)

§group_name: Option<String>

Custom fields within the same group will be displayed together

§description: Option<String>§required: Option<bool>

This field is required when creating new objects or editing an existing object.

§unique: Option<bool>

The value of this field must be unique for the assigned object

§search_weight: Option<i32>

Weighting for search. Lower values are considered more important. Fields with a search weight of zero will be ignored.

§filter_logic: Option<FilterLogic>
  • disabled - Disabled * loose - Loose * exact - Exact
§ui_visible: Option<UiVisible>
  • always - Always * if-set - If set * hidden - Hidden
§ui_editable: Option<UiEditable>
  • yes - Yes * no - No * hidden - Hidden
§is_cloneable: Option<bool>

Replicate this value when cloning objects

§default: Option<Option<Value>>

Default value for the field (must be a JSON value). Encapsulate strings with double quotes (e.g. "Foo").

§related_object_filter: Option<Option<Value>>

Filter the object selection choices using a query_params dict (must be a JSON value).Encapsulate strings with double quotes (e.g. "Foo").

§weight: Option<i32>

Fields with higher weights appear lower in a form.

§validation_minimum: Option<Option<f64>>

Minimum allowed value (for numeric fields)

§validation_maximum: Option<Option<f64>>

Maximum allowed value (for numeric fields)

§validation_regex: Option<String>

Regular expression to enforce on text field values. Use ^ and $ to force matching of entire string. For example, ^[A-Z]{3}$ will limit values to exactly three uppercase letters.

§choice_set: Option<Option<Box<CustomFieldRequestChoiceSet>>>§comments: Option<String>

Implementations§

Source§

impl CustomFieldRequest

Source

pub fn new( object_types: Vec<String>, type: RHashType, name: String, ) -> CustomFieldRequest

Extends the built-in ModelSerializer to enforce calling full_clean() on a copy of the associated instance during validation. (DRF does not do this by default; see https://github.com/encode/django-rest-framework/issues/3144)

Trait Implementations§

Source§

impl Clone for CustomFieldRequest

Source§

fn clone(&self) -> CustomFieldRequest

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for CustomFieldRequest

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for CustomFieldRequest

Source§

fn default() -> CustomFieldRequest

Returns the “default value” for a type. Read more
Source§

impl<'de> Deserialize<'de> for CustomFieldRequest

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl PartialEq for CustomFieldRequest

Source§

fn eq(&self, other: &CustomFieldRequest) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl Serialize for CustomFieldRequest

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more
Source§

impl StructuralPartialEq for CustomFieldRequest

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,