小编uni*_*ack的帖子

13
推荐指数
1
解决办法
7331
查看次数

Windows Phone 7(WP7)PhotoChooserTask with Crop

我在很多应用程序中都看到了这一点,但在文档或在线示例中找不到任何内容.

当您调用PhotoChooserTask时,某些应用程序可让您调整大小/裁剪以仅使用该图像的一部分(通过显示白色矩形).如何使用它并为目标图像设置我自己的尺寸?

windows-phone-7

10
推荐指数
2
解决办法
2306
查看次数

Redcarpet 2.0.1

我正在学习本教程,但它仍然没有说"Redcarpet:Module"的"未定义的方法`new".我的Gemfile中有gem"redcarpet".失败的代码片段:

Redcarpet.new(@post.content).to_html
Run Code Online (Sandbox Code Playgroud)

ruby-on-rails-3 redcarpet

6
推荐指数
1
解决办法
2486
查看次数

Django,ModelForms,User和UserProfile - 不是哈希密码

我正在尝试设置User - UserProfile关系,显示表单并保存数据.

提交后,将保存数据,密码字段不会被哈希处理.

Forms.py

class UserForm(forms.ModelForm):
    username = forms.RegexField(label="Username", max_length=30,
         regex=r'^[\w.@+-]+$', help_text = "My text",
         error_messages = {'invalid':
           "This value may contain only letters, numbers and @/./+/-/_ characters."
         }
    )
    password = forms.CharField(label="Password",
                              widget=forms.PasswordInput)

    class Meta:
        model = User
        fields = ["first_name", "last_name", "username",  "email", "password"]

    def clean_username(self):
        username = self.cleaned_data['username']
        if not re.search(r'^\w+$', username):
            raise forms.ValidationError(
                  'Username can contain only alphanumeric characters')
        try:
            User.objects.get(username=username)
        except ObjectDoesNotExist:
            return username
        raise forms.ValidationError('Username is already taken')

class UserProfileForm(forms.ModelForm):
    class …
Run Code Online (Sandbox Code Playgroud)

django django-forms

5
推荐指数
2
解决办法
5509
查看次数