Skip to content
GitLab
Projects Groups Snippets
  • /
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in / Register
  • D django-mongoforms
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 2
    • Issues 2
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 1
    • Merge requests 1
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
  • Deployments
    • Deployments
    • Environments
    • Releases
  • Packages and registries
    • Packages and registries
    • Package Registry
    • Infrastructure Registry
  • Monitor
    • Monitor
    • Incidents
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Repository
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • Stephan Jaekel
  • django-mongoforms
  • Issues
  • #23
Something went wrong while setting issue due date.
Closed
Open
Issue created 12 years ago by Administrator@rootContributor
  • New related issue

  • Report abuse to administrator

  • New related issue

  • Report abuse to administrator

stringField regex supported?

Closed

stringField regex supported?

Created by: PhoenixAndMachine

I made a ModelForm by metaclass a document, but in which the stringField seems not to support regex in model. with error such as:

Error when calling the metaclass bases init() got an unexpected keyword argument 'regex'

  1. Oh no!

    You are trying to upload something other than an image. Please upload a .png, .jpg, .jpeg, .gif, .bmp, .tiff or .ico.

    Incoming!

    Drop your designs to start your upload.
Tasks
0
server returned results with length 1, expected length of 9

Linked items
0

Link issues together to show that they're related. Learn more.

Activity


  • Administrator
    Administrator @root · 12 years ago
    Author Contributor

    Created by: lig

    Regexes are supported for Document StringFields in django-mongoforms.

    Could you please provide exact code of your form class containing form class definition and string field definition in the form and in the document class.

  • Administrator
    Administrator @root · 12 years ago
    Author Contributor

    Created by: PhoenixAndMachine

    models.py

    from mongoengine import *
    from django.utils.translation import ugettext_lazy as _
    from mongoengine.django.auth import *
    # Create your models here.
    
    class Customer(User):
        email = EmailField(verbose_name=_("email"))
        phone_number = StringField(regex='\d{11}', verbose_name=_("phone"))
        addresses = ListField(StringField(max_length=1024), verbose_name=_("addresses"))
        birthday = DateTimeField(verbose_name=_("birthday"))

    forms.py

    class CustomerRegisterLoginForm(MongoForm):
        class Meta:
            document = Customer
            fields = ['phone_number']

    views.py

    def create_user(request):
        customer_register_form = CustomerRegisterLoginForm()
        print customer_register_form
        context = RequestContext(request, {'customer_register_form': customer_register_form})
        return render_to_response('create_user.html', context)
    
  • Administrator
    Administrator @root · 12 years ago
    Author Contributor

    Created by: lig

    @PhoenixGrey0108 Thank you!

    I will look into it shortly.

  • Administrator
    Administrator @root · 12 years ago
    Author Contributor

    Created by: lig

    Found the bug cause. Going to fix.

  • Administrator
    Administrator @root · 12 years ago
    Author Contributor

    Created by: lig

    Fix committed into issue_23 branch https://github.com/stephrdev/django-mongoforms/commit/03c940f4409f02d45d5a2b7574902e58ebd90b57

  • Administrator
    Administrator @root · 12 years ago
    Author Contributor

    Created by: lig

    Fixed. Fix released in v0.3.1. Uploaded to pypi.

  • Administrator closed 12 years ago

    closed

Please register or sign in to reply
0 Assignees
None
Assign to
Labels
0
None
0
None
    Assign labels
  • Manage project labels

Milestone
No milestone
None
Due date
None
None
None
Time tracking
No estimate or time spent
Confidentiality
Not confidential
Not confidential

You are going to turn on confidentiality. Only project members with at least the Reporter role, the author, and assignees can view or be notified about this issue.

Lock issue
Unlocked
1
1 participant
Administrator
Reference: