Ejemplo n.º 1
0
def reverse(viewname,
            urlconf=None,
            args=None,
            kwargs=None,
            current_app=None,
            external=False):
    url = dj_reverse(viewname,
                     urlconf=urlconf,
                     args=args,
                     kwargs=kwargs,
                     current_app=current_app)
    if external:
        url = settings.SITE_URL.strip('/') + url
    return url
Ejemplo n.º 2
0
 def test_create_meal_category_by_user(self):
     data = get_login_data(USER_LOGIN_DATA['email'],
                           USER_LOGIN_DATA['password'])
     login_url = api_reverse("api-login")
     client = APIClient()
     response = client.post(login_url, data, format='json')
     if response.status_code == status.HTTP_200_OK:
         self.access_token = response.data.get('access')
         data = {
             'name': "TestName",
             'description': "Test Description",
             'image_url': "http://image.com/image.jpg"
         }
         url = BASE_URL + dj_reverse("api:categories")
         head = {'Authorization': 'Bearer ' + str(self.access_token)}
         response = requests.post(url, data, headers=head)
         self.assertEqual(response.status_code, status.HTTP_403_FORBIDDEN)
     else:
         self.fail("Unable to login")
     client.logout()
Ejemplo n.º 3
0
 def get_validation_url(self, instance):
     return absolutify(
         dj_reverse('devhub.upload_detail', args=[instance.uuid.hex]))
Ejemplo n.º 4
0
 def get_validation_url(self, instance):
     return absolutify(
         dj_reverse('devhub.upload_detail', args=[instance.uuid.hex]))
Ejemplo n.º 5
0
 def get_like_url(self):
     return dj_reverse("dj-post-like-toggle", kwargs={'pk': self.pk})
Ejemplo n.º 6
0
 def get_absolute_url(self):
     return dj_reverse('dj-post-detail', kwargs={'pk': self.pk})