Django models, How to make two optional fields, but when one is filled, the other one must also be filled

So, I have created a model which has some attributes, but I want to focus on these two. class Profile(models.Model): RANK_OPTIONS = ( (‘A’, ‘A’), (‘B’, ‘B’), ) related_office = models.ForeignKey(‘OtherModule.office’, related_name=’office’, on_delete=models.CASCADE ) rank = models.CharField((‘rank’),max_length=1, choices=RANK_OPTIONS) Basically, I need these two attributes to be optional, but the moment the attribute “Rank” is filled,…

Details

How to get child table values in frappe.route_options along with Parent table values

In sales order , I have a button for creating Allotment which is a custom doctype. Using frappe.set_route I am able to get parent table values but not sure how to get child table values along with it. Kindly help, thanks! frappe.ui.form.on(‘Sales Order’, ‘refresh’, function(frm) { frm.add_custom_button( __(‘Make Allotment’), function() { frappe.route_options = { customer:…

Details

Different colors in columns, Padas DataFrame

I have Pandas DataFrame like this: data = pd.DataFrame({“fuel”:[“gas”,”gas”,”diesel”,”diesel”,”gas”,”diesel”]}) And I used code to make a bar plot: ax1 = data.fuel.value_counts().plot(‘bar’) ax1.set(xlabel = ‘Fuel Type’, ylabel=’Frequency of fuel type’) Nevertheless, I have both column in one colo (blue). What should I do to have different colors of columns?

Details