Showing posts from May, 2014

Implementing a Multiple (Radio) Select + “Other” widget in Django

I have had a task to implement Radio Select field with "Other" choice field in a Django Model Form. Here is my implementation in case someone would benefit from it. The idea is to have it all stored to Django's CharField type of data and have a preselected set of fields. We have a model:
# models.pyclassEntry(models.Model):SET_OF_CHOICES=(('choice1','choice1'),('choice2','choice2'),('choice3','choice3'),('Other','Other Please Specify'),)choice=models.CharField(_("Selected your choice"),max_length=250) That makes it ready for the set of fields for for our form. We are overriding Model form default field for this type of data (CharField) by intentionally specifying field with the same name.
# forms.pyfromdjango.formsimportModelForm,ChoiceField,RadioSelectfrommodelsimportEntryfromfieldsimportChoiceWithOtherFieldclassEntryForm(ModelForm):choice=ChoiceWithOtherField(label=_("Selected your choice&quo…

How to delete a remote git tag

I'm always forgetting this. So decided to put it here for someone's benefit.

I have the git tag added by command:
gittag-a1.2.0-m"1.2.0" this means my tags tree will be updated with the tag 1.2.0 and message 1.2.0
Usually it marks the version of the build/release.

I now push a tag to origin by command:
gitpushorigin--tags It is possible to see it at my repository github tagged.

Time now to delete a tag.
It can be done by command:
gittag-d1.2.0 This will remove a local tag 1.2.0. Leaving origin intact. Pushing tags to origin does not give anything.
To remove a remote tag now it is required to execute command:
gitpushorigin:refs/tags/1.2.0 It will remove tag 1.2.0 at origin. This is the only way how to move tags to another commits.