10

Given the following django URL conf. entry:

url(r'^(?P<obj_ctype_name>\w+)/(?P<obj_id>\d+)/$',
    views.obj_view,
    name='obj_view')

How would I rewrite the parameter (?P<obj_ctype_name>\w+) to enforce that it may only be one of "foo" "bar" or "baz" and still keep it as a named parameter?

Pet Halibut
  • 103
  • 1
  • 4

1 Answers1

25

(?P<obj_ctype_name>foo|bar|baz)

Ben James
  • 121,135
  • 26
  • 193
  • 155