在TFS中删除本地文件夹(Delete Local Folder in TFS)
我是TFS映射的大型项目的一部分,在该项目中有一个我已经完成工作的文件夹。 我不想要该文件夹,所以我想删除我的本地副本。 问题是TFS想要镜像更改并从源代码控制中删除该文件夹,我不想将其从TFS中删除。
我可以找到的唯一方法是取消映射工作空间,然后通过并获取我需要处理的所有其他文件夹。
有没有办法我可以在本地删除该文件夹?
I'm part of a large project mapped from TFS, within that project there is a folder which I have finished working on. I don't want that folder anymore so I'd like to delete my local copy. The problem is that TFS wants to mirror the change and delete the folder from source control, I don't want to remove it from TFS.
The only way I can find to do this is to unmap the workspace, and then go through and get all the other folders I need to work on.
Is there anyway I can just delete that folder locally?
原文:https://stackoverflow.com/questions/19785117
最满意答案
在表单库方面,您可以使用带有CheckboxSelectMultiple窗口小部件的MultipleChoiceField字段来执行此操作。 您可以通过编写该字段的验证方法来验证所做的选择次数:
class MyForm(forms.Form): my_field = forms.MultipleChoiceField(choices=SOME_CHOICES, widget=forms.CheckboxSelectMultiple()) def clean_my_field(self): if len(self.cleaned_data['my_field']) > 3: raise forms.ValidationError('Select no more than 3.') return self.cleaned_data['my_field']
要在管理应用程序中获取此信息,您需要自定义一个ModelForm并覆盖相应的ModelAdmin中使用的表单 。
In terms of the forms library, you would use the MultipleChoiceField field with a CheckboxSelectMultiple widget to do that. You could validate the number of choices which were made by writing a validation method for the field:
class MyForm(forms.Form): my_field = forms.MultipleChoiceField(choices=SOME_CHOICES, widget=forms.CheckboxSelectMultiple()) def clean_my_field(self): if len(self.cleaned_data['my_field']) > 3: raise forms.ValidationError('Select no more than 3.') return self.cleaned_data['my_field']
To get this in the admin application, you'd need to customise a ModelForm and override the form used in the appropriate ModelAdmin.
相关问答
更多-
缩小Django的选择范围(Narrowing choices in Django form)[2023-01-27]
这是我限制显示的选项: 在forms.py中为你的表单添加一个init方法 class TaskForm(forms.ModelForm): .... def __init__(self, user, *args, **kwargs): ''' limit the choice of owner to the currently logged in users hats ''' super(TaskForm, self)._ ... -
在表单库方面,您可以使用带有CheckboxSelectMultiple窗口小部件的MultipleChoiceField字段来执行此操作。 您可以通过编写该字段的验证方法来验证所做的选择次数: class MyForm(forms.Form): my_field = forms.MultipleChoiceField(choices=SOME_CHOICES, widget=forms.CheckboxSelectMultiple()) def clean_my_field(self): ...
-
这是BiomSearchJob和EcosystemChoices之间ManyToMany关系的一个用例。 这将为您实现一个中间表。 编辑:添加以下示例实现: class BiomSearchJob(models.Model): user = models.ForeignKey(User, on_delete=models.CASCADE) completed = models.BooleanField(default=False) criteria = models.ManyToMa ...
-
你可以尝试使用CSS来做这件事,但事情是非常困难的: http : //www.456bereastreet.com/lab/form_controls/checkboxes/ 当你在css中创建一个类时,你可以使用小部件将它添加到你的输入中,例如: field = forms.BooleanField(widget=forms.CheckboxInput(attrs={'class':'your_class'})) You can try doing this using css, but the th ...
-
Django Forms:强制用户一次只选择一个复选框(Django Forms: Force the user to select one checkbox only at a time)[2022-12-10]
您应该使用ChoiceField而不是MultipleChoiceField : class MyForm(forms.Form): colors = forms.ChoiceField(choices=COLORS) 这将允许用户从COLORS选项中仅选择一种 color 。 You should use ChoiceField instead of MultipleChoiceField: class MyForm(forms.Form): colors = forms.ChoiceF ... -
Django MultipleChoiceField对选择元组的限制(Django MultipleChoiceField restrictions on choices tuple)[2023-07-24]
表格不必是唯一的。 您可以在调用时为表单指定前缀: form_1 = DataTypeForm(request.POST or None,initial_value=True,prefix="1") form_2 = DataTypeForm(request.POST or None,initial_value=False,prefix="2") The forms don't have to be unique. You can specify a prefix for the form when yo ... -
那么,django生成的选择只是选择。 这个帮助文本会在哪里显示? Html5允许所有元素的title属性( http://www.w3schools.com/tags/att_global_title.asp )。 但是要显示这个元素,你必须为此创建自己的django小部件。 一个小部件,不仅接受选择,还接受选择和帮助文本。 然后将它们作为选项标题呈现。 我想这是尽可能轻量级的。 使用一些js库来制作这些helptexts也是你设置:) Well, the selects generated by dja ...
-
我不认为你可以在不查询每个对象的情况下做到这一点。 我会建议, [(x.name, x.get_choices_display(), ) for x in Blog.objects.all()] 如果你想一次性拍摄它。 如果您想定期使用它,您可以在Blog模型中创建一个方法。 I don't think you can do that without querying every objects. I would suggest, [(x.name, x.get_choices_display(), ) ...
-
为表单提供一个__init__方法,该方法将CarBrand作为参数,然后将查询集设置为基于以下内容进行选择: class CarForm(forms.Form): def __init__(self, car_brand, *args, **kwargs): self.fields['cars'] = forms.ModelMultipleChoiceField( queryset=CarModel.objects.filter(brand=car_bran ...
-
Django对变量使用两种标记 - {% ... %}用于标记 , {{ ... }}用于变量 。 在此代码中,您试图呈现product_category_level1 变量 ,因此您应该在模板中使用{{ product_category_level1 }}而不是{% product_category_level1 %} 。 但是,这个代码中还有一些其他的错误。 您好像在视图代码中混合了product_category_level1和product_category_level1_form 。 这些都应该是 ...