Is your "API_dispatcher" url before or after the admin url?
On Wednesday, 22 January 2014 08:50:14 UTC+11, Dharwin Perez wrote:
>
> I was trying to make a API Dispatcher, but when i try to add anything in
> Django Admin, run APIdispatcher and return Bad Request. I think that is
> some in the URL because when i comment those line, Django Admin works
> correctly.
>
> urls.py
>
> url(r'^(?P<version>.*)/(?P<table>.*)/(?P<secret_key>.*)/(?P<mac_address>.*)/$',
>
> 'People.views.APIdispatcher', name='API_dispatcher')
>
> views.py
>
> @csrf_exempt
> def APIdispatcher(request,version,table,secret_key,mac_address):
> # Verificamos que sea una peticion POST
> if request.method == 'POST':
>
> if _version == 'V0.9' or _version == 'v0.9':
> apiV09()
> elif _version == 'V1.0' or _version == 'v1.0':
> apiV10( )
> return HttpResponse(status=200)
>
> else:
> return HttpResponseBadRequest()
> else:
> return HttpResponseBadRequest()
>
> admin.py
>
> admin.site.register(Application)
>>
>
> models.py
>
> class Application(models.Model):
>
>
>> application_id = models.AutoField(
>
> primary_key = True )
>
>
>> name = models.CharField(
>
> max_length = 200,
>
> blank = False,
>
> null = False,
>
> unique = True )
>
>
>> secret_key = models.CharField(
>
> max_length = 150,
>
> blank = True,
>
> null = True,
>
> unique = True )
>
>
>>
>> creation_date = models.DateField( auto_now_add = True )
>
> creation_ts = models.DateTimeField( auto_now_add = True )
>
> modification_date = models.DateField( auto_now = True )
>
> modification_ts = models.DateTimeField( auto_now = True )
>
> status = models.CharField(
>
> max_length = 20,
>
> choices = (
>
> ('1','ACTIVA'),
>
> ('2','SUSPENDIDA'),
>
> ('3','MANTENIMIENTO'),
>
> ('4','ELIMINADA')
>
> ),
>
> default = '1'
>
> )
>
>
>
> class Meta:
>
> db_table = 'Applications'
>
> verbose_name = 'Application'
>
> verbose_name_plural = 'Applications'
>
>
>> def __unicode__(self):
>
> return self.name
>
>
>
--
You received this message because you are subscribed to the Google Groups
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit
https://groups.google.com/d/msgid/django-users/7c4977b5-915b-4ea6-a972-f19aa44a76ae%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.