Re: Multiple app css,html, javascript,img

2017-02-16 Thread Jani Tiainen

Hi,

You need to put static files under static directory within app. Now you 
have static resources at your app root. So layout should be:


users/
static/
css/
style.css


On 17.02.2017 08:15, Kazi Atik wrote:

Hi Everyone,

I am having multiple app in my project so i want to make globally 
these css, js,img folder because every time making css,js,img folder 
very difficult and slowing my development of

my project please give me solution

myfb
users/
__init__.py
models.py
views.py
urls.py
templates/
login.html
dashboard.html
logout.html
css/
 style.css
---
categories/
__init__.py
models.py
views.py
urls.py
templates/
post.html
friends.html
upload.html
css/
 user.css
img/
 fb.jpg
  JS/
  boot.min.js



--
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 django-users+unsubscr...@googlegroups.com 
.
To post to this group, send email to django-users@googlegroups.com 
.

Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/215f85be-b377-4f44-a3bb-0e9311f31c35%40googlegroups.com 
.

For more options, visit https://groups.google.com/d/optout.


--
Jani Tiainen

--
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 django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/d845f92b-f408-7c28-f7fc-47a9af165aac%40gmail.com.
For more options, visit https://groups.google.com/d/optout.


Multiple app css,html, javascript,img

2017-02-16 Thread Kazi Atik
Hi Everyone,

I am having multiple app in my project so i want to make globally these 
css, js,img folder because every time making css,js,img folder very 
difficult and slowing my development of
my project please give me solution 

myfb
users/
__init__.py
models.py
views.py
urls.py
templates/
login.html
dashboard.html
logout.html
css/
 style.css
---
categories/
__init__.py
models.py
views.py
urls.py
templates/
post.html
friends.html
upload.html
css/
 user.css
img/
 fb.jpg
  JS/
  boot.min.js



-- 
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 django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/215f85be-b377-4f44-a3bb-0e9311f31c35%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Extract Date-From and Date-To in DateRangeField django

2017-02-16 Thread RON MICHAEL
Hi! In my database I have a DateRangeField. What I want to do is get the 
date-from and the date-to and store them in a separate variable like 
example:

date_from =DateRangeField(date_from)
date_to =DateRangeField(date_to)


of course that code won't work. My data is like this:

'date_range': DateRange(datetime.date(2017, 2, 17), datetime.date(2017, 2, 18), 
'[)')




How do I get those dates?

Btw, I've tried indexing this, and it doesn't work. I've tried iterating 
it, but it also doesn't work. 


-- 
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 django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/848d9e95-4701-4984-bfee-64526621084e%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: OpenFace Integration with Django

2017-02-16 Thread RON MICHAEL
Great! I've tried logging stuff but it doesn't seem to work when uploading 
it to a webserver. When running on my localhost server there was a log 
about a depreciation, then when it was doing training, then when it has 
finished training. But I can't seem to see it in the webserver terminal :/

On Thursday, February 16, 2017 at 12:24:40 AM UTC+8, Shawn Milochik wrote:
>
> It's probably some difference between environments. If you know your code 
> works (it runs locally) and you're running the same versions of all your 
> dependencies (Python, Django, Openface, etc.), then it doesn't *seem* too 
> likely to be a major bug. It *could* be a bug -- not checking for and 
> handling an exceptional condition. For example, what if your code processes 
> each file in a directory -- but that directory is empty? It'll "work" 
> perfectly, and return nothing.
>
> Add some logging along the way -- see what files it sees, what directories 
> it's looking it, etc. If you're hitting any external resources (APIs, 
> databases, etc.) make sure that your credentials work from your server and 
> that the services are available.
>

-- 
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 django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/cb3b5747-08ad-4844-809c-c2ccba7c2e37%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


RE: Error using url in django template language

2017-02-16 Thread Matthew Pava
In your urls.py, you have the url name as “ytlinks” with an s.  But your url 
tag doesn’t have the s.
Try this:
{% url ‘ytlinks.ytlinks’ %}


From: django-users@googlegroups.com [mailto:django-users@googlegroups.com] On 
Behalf Of xyron
Sent: Thursday, February 16, 2017 9:35 AM
To: Django users
Subject: Error using url in django template language

Hey there,

I'm searching since more than 12 hours for a solution for my problem and I'm 
kinda frustrated.

I want to use a form and define the action link using django template language 
in a html-file:


{% extends "base/header.html" %}
{% block content %}

  
   Enter Youtube-Link


I get following error:

Reverse for 'links.views.save_ytlink' with arguments '()' and keyword arguments 
'{}' not found. 0 pattern(s) tried: []

My project structure looks like this:

mysite
├───links
│   ├───templates
│   │   └───home.html
│   ├───urls.py
│   └───views.py
└───mainapp
├───templates
│   ├───base
│   │   └───header.html
│   ├───links
│   └───register
├───urls.py
└───views.py

mainapp.urls.py looks like this:


urlpatterns = [
url(r'^', include('links.urls', namespace='ytlinks'), name='index'),
url(r'^admin/', admin.site.urls),
url(r'^register', include('register.urls'), name='register'),
url(r'^ytlinks/', include('links.urls', namespace='ytlinks')),
]

links.urls.py looks like this:


urlpatterns = [
   url(r'^save_ytlink', views.save_ytlink, name='save_ytlink'),
   url(r'^list$', views.ytlinks_list, name='ytlinks_list'),
   url(r'^', views.ytlinks, name='ytlinks'),
]

links.views.py looks like this:

def save_ytlink(request):
msg = ""
msg_status = "" # possible: 'success', 'info', 'danger', 'warning'

# Check if user came here by form
if request.method == 'GET':
return render(request, 'home.html')

ytlink = request.POST['ytlink']
allow_save = True

# Validation
# ...

return render(request, 'home.html', {'queryset':'', 'msg':msg, 
'msg_status':msg_status})

Things I tried:














(and much more)


I tried to set namespaces, to see if it makes any difference. Also stuff with 
../views.save_ytlink didn't work.

Even if I create a file (test.html) in the same directory, it won't work.

{% url 'test.html' %}

It seems that I can't resolve any kind of URL. If I set  it works.

Your help is really, really appreciated. I don't know anymore what to do.

So long, xyron

--
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 
django-users+unsubscr...@googlegroups.com.
To post to this group, send email to 
django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/8c09cef7-1ee3-4f38-9776-601998692621%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

-- 
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 django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/1030a2b4d9754b9cb75cc695a7e6de25%40ISS1.ISS.LOCAL.
For more options, visit https://groups.google.com/d/optout.


Re: Append to models.JSONField on POST

2017-02-16 Thread ludovic coues
If there is one, I've never heard of it. But I'm not an heavy user of
postgres or its JSONField.
Maybe someone else know better than me :)

2017-02-16 17:30 GMT+01:00 chris jess :
> Thanks.
>
> Was hoping there was a method for appending to a JSON array stored in a
> JSONField without fetching the whole record first.
>
> On Thursday, 16 February 2017 16:24:06 UTC, ludovic coues wrote:
>>
>> You can't.
>>
>> There is 7 value types in JSON.
>> 3 of them are constant, true, false and null. Appending to them make no
>> sense.
>> You could append to number, but then you change its value.
>> String are double quote delimited. You can't append to it, you need to
>> insert before the closing double quote. aka updating.
>> Any way, I'm pretty sure JSONField don't let you use these values as
>> root object for some reason.
>>
>> The two remaining value types are array and object. Both suffer from
>> the same issue as string, they are delimited and you can't simply
>> append at the end, you need to insert data, aka updating.
>>
>>
>> If you know what you are doing, read the source, look at how to update
>> the raw value, write some test to make sure what you are doing is
>> working now and is working each time you upgrade django.
>>
>> I wish you good luck if you go down that path and to have a good
>> experience.
>>
>> 2017-02-16 16:53 GMT+01:00 chris jess :
>> > Can anyone let me know the best way to append to a models.JSONField on
>> > HTTP
>> > POST?
>> >
>> > I would prefer to simply append to the existing JSONField as opposed to
>> > updating the values in it.
>> >
>> > Is it possible to do this without first loading that object?
>> >
>> > Thanks.
>> >
>> > --
>> > 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 django-users...@googlegroups.com.
>> > To post to this group, send email to django...@googlegroups.com.
>> > Visit this group at https://groups.google.com/group/django-users.
>> > To view this discussion on the web visit
>> >
>> > https://groups.google.com/d/msgid/django-users/2c044960-3a7a-4997-ba43-eeb7b1747566%40googlegroups.com.
>> > For more options, visit https://groups.google.com/d/optout.
>>
>>
>>
>> --
>>
>> Cordialement, Coues Ludovic
>> +336 148 743 42
>
> --
> 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 django-users+unsubscr...@googlegroups.com.
> To post to this group, send email to django-users@googlegroups.com.
> Visit this group at https://groups.google.com/group/django-users.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/f39ffbe6-e1e2-457f-9298-932ee2574306%40googlegroups.com.
>
> For more options, visit https://groups.google.com/d/optout.



-- 

Cordialement, Coues Ludovic
+336 148 743 42

-- 
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 django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAEuG%2BTau4w-H%3DaQicnOrwBM23L8fEu57T4yiErTaxR1Wco3T8A%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Django template language resolve url

2017-02-16 Thread ludovic coues
First, I would make sure all namespace are unique.

Then I would try {% url "ytlinks:save_ytlink" %}
In 'links.views.save_ytlink', I have no idea what links or views are.

You might also want to re-read the documentation on urls namespace and
included urlconfs
https://docs.djangoproject.com/en/1.10/topics/http/urls/#url-namespaces-and-included-urlconfs

2017-02-16 16:52 GMT+01:00 xyron :
> Code hier eingeben...
>
> Hey there,
>
> I'm searching since more than 12 hours for a solution for my problem and I'm
> kinda frustrated.
>
> I want to use a form and define the link using django template language in a
> html-file:
>
> {% extends "base/header.html" %}
> {% block content %}
>
>   
>Enter Youtube-Link
> 
>
> I get following error:
>
> Reverse for 'links.views.save_ytlink' with arguments '()' and keyword
> arguments '{}' not found. 0 pattern(s) tried: []
>
> My project structure looks like this:
>
> mysite
> +---links
> ¦   +---templates
> ¦   ¦   +---home.html
> ¦   +---urls.py
> ¦   +---views.py
> +---mainapp
> +---templates
> ¦   +---base
> ¦   ¦   +---header.html
> ¦   +---links
> ¦   +---register
> +---urls.py
> +---views.py
>
>
> mainapp.urls.py looks like this:
>
> urlpatterns = [
> url(r'^', include('links.urls', namespace='ytlinks'), name='index'),
> url(r'^admin/', admin.site.urls),
> url(r'^register', include('register.urls'), name='register'),
> url(r'^ytlinks/', include('links.urls', namespace='ytlinks')),
> ]
>
>
> links.urls.py looks like this:
>
> urlpatterns = [
>url(r'^save_ytlink', views.save_ytlink, name='save_ytlink'),
>url(r'^list$', views.ytlinks_list, name='ytlinks_list'),
>url(r'^', views.ytlinks, name='ytlinks'),
> ]
>
>
> links.views.py looks like this:
>
> def save_ytlink(request):
> msg = ""
> msg_status = "" # possible: 'success', 'info', 'danger', 'warning'
>
>
> # Check if user came here by form
> if request.method == 'GET':
> return render(request, 'home.html')
>
>
> ytlink = request.POST['ytlink']
> allow_save = True
>
>
> # Validation
> # ...
>
>
> return render(request, 'home.html', {'queryset':'', 'msg':msg,
> 'msg_status':msg_status})
>
>
> Things I tried:
>
> 
> 
> 
> 
> 
>
> (and much more)
>
> I tried to set namespaces, to see if it makes any difference. Also stuff
> with ../views.save_ytlink didn't work.
>
> Also if I create a file called "test.html" (located in the same directory),
> it doesn't  change the error.
>
> {% url 'test.html' %}
>
> If I use:
>
> 
>
> It works.
>
> What am I doing wrong? I really, really appreciate any attempt to help.
>
> xyron
>
>
> --
> 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 django-users+unsubscr...@googlegroups.com.
> To post to this group, send email to django-users@googlegroups.com.
> Visit this group at https://groups.google.com/group/django-users.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/9d3cb6ff-3bea-458f-94b2-ff72a7b53045%40googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.



-- 

Cordialement, Coues Ludovic
+336 148 743 42

-- 
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 django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAEuG%2BTacxPg283AxpNraK4sOdFNM97ERAoBsvL3rWW7gDpwoTA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Append to models.JSONField on POST

2017-02-16 Thread chris jess
Thanks. 

Was hoping there was a method for appending to a JSON array stored in a 
JSONField without fetching the whole record first.

On Thursday, 16 February 2017 16:24:06 UTC, ludovic coues wrote:
>
> You can't. 
>
> There is 7 value types in JSON. 
> 3 of them are constant, true, false and null. Appending to them make no 
> sense. 
> You could append to number, but then you change its value. 
> String are double quote delimited. You can't append to it, you need to 
> insert before the closing double quote. aka updating. 
> Any way, I'm pretty sure JSONField don't let you use these values as 
> root object for some reason. 
>
> The two remaining value types are array and object. Both suffer from 
> the same issue as string, they are delimited and you can't simply 
> append at the end, you need to insert data, aka updating. 
>
>
> If you know what you are doing, read the source, look at how to update 
> the raw value, write some test to make sure what you are doing is 
> working now and is working each time you upgrade django. 
>
> I wish you good luck if you go down that path and to have a good 
> experience. 
>
> 2017-02-16 16:53 GMT+01:00 chris jess >: 
> > Can anyone let me know the best way to append to a models.JSONField on 
> HTTP 
> > POST? 
> > 
> > I would prefer to simply append to the existing JSONField as opposed to 
> > updating the values in it. 
> > 
> > Is it possible to do this without first loading that object? 
> > 
> > Thanks. 
> > 
> > -- 
> > 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 django-users...@googlegroups.com . 
> > To post to this group, send email to django...@googlegroups.com 
> . 
> > Visit this group at https://groups.google.com/group/django-users. 
> > To view this discussion on the web visit 
> > 
> https://groups.google.com/d/msgid/django-users/2c044960-3a7a-4997-ba43-eeb7b1747566%40googlegroups.com.
>  
>
> > For more options, visit https://groups.google.com/d/optout. 
>
>
>
> -- 
>
> Cordialement, Coues Ludovic 
> +336 148 743 42 
>

-- 
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 django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/f39ffbe6-e1e2-457f-9298-932ee2574306%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Append to models.JSONField on POST

2017-02-16 Thread ludovic coues
You can't.

There is 7 value types in JSON.
3 of them are constant, true, false and null. Appending to them make no sense.
You could append to number, but then you change its value.
String are double quote delimited. You can't append to it, you need to
insert before the closing double quote. aka updating.
Any way, I'm pretty sure JSONField don't let you use these values as
root object for some reason.

The two remaining value types are array and object. Both suffer from
the same issue as string, they are delimited and you can't simply
append at the end, you need to insert data, aka updating.


If you know what you are doing, read the source, look at how to update
the raw value, write some test to make sure what you are doing is
working now and is working each time you upgrade django.

I wish you good luck if you go down that path and to have a good experience.

2017-02-16 16:53 GMT+01:00 chris jess :
> Can anyone let me know the best way to append to a models.JSONField on HTTP
> POST?
>
> I would prefer to simply append to the existing JSONField as opposed to
> updating the values in it.
>
> Is it possible to do this without first loading that object?
>
> Thanks.
>
> --
> 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 django-users+unsubscr...@googlegroups.com.
> To post to this group, send email to django-users@googlegroups.com.
> Visit this group at https://groups.google.com/group/django-users.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/2c044960-3a7a-4997-ba43-eeb7b1747566%40googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.



-- 

Cordialement, Coues Ludovic
+336 148 743 42

-- 
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 django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAEuG%2BTbtwL8_b-uYOQPzEuw7KA2vU4otLOj_-kPa0LwskH8Y4A%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Append to models.JSONField on POST

2017-02-16 Thread chris jess
Can anyone let me know the best way to append to a models.JSONField on HTTP 
POST?

I would prefer to simply append to the existing JSONField as opposed to 
updating the values in it.

Is it possible to do this without first loading that object?

Thanks.

-- 
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 django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/55b077c7-e67d-4d26-a6f1-646bc8dddecf%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Error using url in django template language

2017-02-16 Thread xyron
Hey there,

I'm searching since more than 12 hours for a solution for my problem and 
I'm kinda frustrated.

I want to use a form and define the action link using django template 
language in a html-file:

{% extends "base/header.html" %}
{% block content %}

  
   Enter Youtube-Link



I get following error:

*Reverse for 'links.views.save_ytlink' with arguments '()' and keyword 
arguments '{}' not found. 0 pattern(s) tried: []*

My project structure looks like this:

mysite
├───links
│   ├───templates
│   │   └───home.html
│   ├───urls.py
│   └───views.py 
└───mainapp
├───templates
│   ├───base
│   │   └───header.html
│   ├───links
│   └───register
├───urls.py
└───views.py

*mainapp.urls.py* looks like this:

urlpatterns = [
url(r'^', include('links.urls', namespace='ytlinks'), name='index'),
url(r'^admin/', admin.site.urls),
url(r'^register', include('register.urls'), name='register'),
url(r'^ytlinks/', include('links.urls', namespace='ytlinks')),
]


*links.urls.py* looks like this:

urlpatterns = [
   url(r'^save_ytlink', views.save_ytlink, name='save_ytlink'),
   url(r'^list$', views.ytlinks_list, name='ytlinks_list'),
   url(r'^', views.ytlinks, name='ytlinks'),
]


*links.views.py* looks like this:

def save_ytlink(request):
msg = ""
msg_status = "" # possible: 'success', 'info', 'danger', 'warning'

# Check if user came here by form
if request.method == 'GET':
return render(request, 'home.html')

ytlink = request.POST['ytlink']
allow_save = True

# Validation
# ...


return render(request, 'home.html', {'queryset':'', 'msg':msg, 'msg_status'
:msg_status})


Things I tried:












(and much more)


I tried to set namespaces, to see if it makes any difference. Also stuff 
with ../views.save_ytlink didn't work.

Even if I create a file (test.html) in the same directory, it won't work.

{% url 'test.html' %}

It seems that I can't resolve any kind of URL. If I set  it works.

Your help is really, really appreciated. I don't know anymore what to do.

So long, xyron

-- 
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 django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/8c09cef7-1ee3-4f38-9776-601998692621%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Django template language resolve url

2017-02-16 Thread xyron
Code hier eingeben...

Hey there,

I'm searching since more than 12 hours for a solution for my problem and 
I'm kinda frustrated.

I want to use a form and define the link using django template language in 
a html-file:

{% extends "base/header.html" %}
{% block content %}

  
   Enter Youtube-Link


I get following error:

Reverse for 'links.views.save_ytlink' with arguments '()' and keyword 
arguments '{}' not found. 0 pattern(s) tried: []

My project structure looks like this:

mysite
+---links
¦   +---templates
¦   ¦   +---home.html
¦   +---urls.py
¦   +---views.py 
+---mainapp
+---templates
¦   +---base
¦   ¦   +---header.html
¦   +---links
¦   +---register
+---urls.py
+---views.py


mainapp.urls.py looks like this:

urlpatterns = [
url(r'^', include('links.urls', namespace='ytlinks'), name='index'),
url(r'^admin/', admin.site.urls),
url(r'^register', include('register.urls'), name='register'),
url(r'^ytlinks/', include('links.urls', namespace='ytlinks')),
]


links.urls.py looks like this:

urlpatterns = [
   url(r'^save_ytlink', views.save_ytlink, name='save_ytlink'),
   url(r'^list$', views.ytlinks_list, name='ytlinks_list'),
   url(r'^', views.ytlinks, name='ytlinks'),
]


links.views.py looks like this:

def save_ytlink(request):
msg = ""
msg_status = "" # possible: 'success', 'info', 'danger', 'warning'


# Check if user came here by form
if request.method == 'GET':
return render(request, 'home.html')


ytlink = request.POST['ytlink']
allow_save = True


# Validation
# ...


return render(request, 'home.html', {'queryset':'', 'msg':msg, 
'msg_status':msg_status})


Things I tried:







(and much more)

I tried to set namespaces, to see if it makes any difference. Also stuff 
with ../views.save_ytlink didn't work.

Also if I create a file called "test.html" (located in the same directory), 
it doesn't  change the error.

{% url 'test.html' %}

If I use:



It works.

What am I doing wrong? I really, really appreciate any attempt to help.

xyron


-- 
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 django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/9d3cb6ff-3bea-458f-94b2-ff72a7b53045%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Append to models.JSONField on POST

2017-02-16 Thread chris jess
Can anyone let me know the best way to append to a models.JSONField on HTTP 
POST?

I would prefer to simply append to the existing JSONField as opposed to 
updating the values in it.

Is it possible to do this without first loading that object?

Thanks.

-- 
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 django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/2c044960-3a7a-4997-ba43-eeb7b1747566%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Hello. Users, permissions, etc.

2017-02-16 Thread ludovic coues
Have you looked at that ?
https://docs.djangoproject.com/en/1.10/topics/auth/default/#topic-authorization

2017-02-16 13:32 GMT+01:00  :
> Good day, I faced with a problem.
> Any database with the information. DB is filled with the site. It is
> necessary to make several groups with different rights to add / edit
> information from site. The first logical step - to make it in the
> administrative part. But the right to work only in the administrative part.
> As the right to move to the site?
>
> --
> 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 django-users+unsubscr...@googlegroups.com.
> To post to this group, send email to django-users@googlegroups.com.
> Visit this group at https://groups.google.com/group/django-users.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/e493b9ca-b536-40cb-84b7-daa4c0af56b6%40googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.



-- 

Cordialement, Coues Ludovic
+336 148 743 42

-- 
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 django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAEuG%2BTZ1oa2vO2iSmNZkmKtr05afYp56xAPyYjT4jRrXxEnCCQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: get_or_create IntegrityError

2017-02-16 Thread Vijay Khemlani
As far as I know Postgres uses "sequences" for generating the model IDs.

If you set the id manually I think you are bypassing the sequence,
which doesn't autoincrement. So when you use the sequence the next
time the ID clashes.

pgAdmin should auto generate the id if you leave the field blank.

On 2/16/17, Matthew Pava  wrote:
> This is a fascinating issue, fellow Django users.
>
> I have a model called Lookups that is basically just an auto-generated pk
> and a name.  I added some data to that table using pgAdmin 3 since I'm using
> a PostgreSQL backend.
> One of my users then filled out a form that ran some code that would
> 'get_or_create' on the Lookups model.  It threw an IntegrityError saying
> that the Key (id)=# already exists.
> Upon further investigation, I realized that the id # was one that I had
> already entered manually in the database several days ago.  Only after the
> user kept running that form until the id incremented to one that did not
> exist did the IntegrityError go away.
>
> Maybe I entered the id manually in pgAdmin 3 instead of letting it do the
> auto-generation and that's why it broke?
>
> But Django was generating the proper SQL, so I can't imagine how Django
> could possibly be involved in addressing this issue:
>
> 'INSERT INTO "general_lookups" ("name") VALUES (%s) RETURNING
> "general_lookups"."id"'
>
>
> Maybe it's more a problem with PostgreSQL, but I wanted to share this with
> you in case you ever run into this issue.  I think for now, I should just
> use Django to enter data into the database, or test pgAdmin to
> auto-increment the id with manual data entry.
>
> --
> 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 django-users+unsubscr...@googlegroups.com.
> To post to this group, send email to django-users@googlegroups.com.
> Visit this group at https://groups.google.com/group/django-users.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/5d108192354c470ca56946d28ffe02b7%40ISS1.ISS.LOCAL.
> For more options, visit https://groups.google.com/d/optout.
>

-- 
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 django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CALn3ei3ZjhY%2BYfZyJUzZamA8t1t3JUw37_mGm%2BY4ymFG%2Bq%3D7Cw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


get_or_create IntegrityError

2017-02-16 Thread Matthew Pava
This is a fascinating issue, fellow Django users.

I have a model called Lookups that is basically just an auto-generated pk and a 
name.  I added some data to that table using pgAdmin 3 since I'm using a 
PostgreSQL backend.
One of my users then filled out a form that ran some code that would 
'get_or_create' on the Lookups model.  It threw an IntegrityError saying that 
the Key (id)=# already exists.
Upon further investigation, I realized that the id # was one that I had already 
entered manually in the database several days ago.  Only after the user kept 
running that form until the id incremented to one that did not exist did the 
IntegrityError go away.

Maybe I entered the id manually in pgAdmin 3 instead of letting it do the 
auto-generation and that's why it broke?

But Django was generating the proper SQL, so I can't imagine how Django could 
possibly be involved in addressing this issue:

'INSERT INTO "general_lookups" ("name") VALUES (%s) RETURNING 
"general_lookups"."id"'


Maybe it's more a problem with PostgreSQL, but I wanted to share this with you 
in case you ever run into this issue.  I think for now, I should just use 
Django to enter data into the database, or test pgAdmin to auto-increment the 
id with manual data entry.

-- 
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 django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/5d108192354c470ca56946d28ffe02b7%40ISS1.ISS.LOCAL.
For more options, visit https://groups.google.com/d/optout.


Re: How to integrate a python algorithm in a Django website

2017-02-16 Thread phep

Hi,

Le 16/02/2017 à 13:30, david ekchajzer a écrit :

How could I use the data from my website database on a python algorithm?


As Shawn pointed out, it seems what you're looking for are Django custom 
commands : 
https://docs.djangoproject.com/en/1.10/howto/custom-management-commands/


Such commands you could run in cron jobs, as François said.

Regards,

phep

--
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 django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/17ed8be9-f004-171e-c8ea-35a4d7501ccc%40teletopie.net.
For more options, visit https://groups.google.com/d/optout.


Hello. Users, permissions, etc.

2017-02-16 Thread lex . for . free
Good day, I faced with a problem.
Any database with the information. DB is filled with the site. It is 
necessary to make several groups with different rights to add / edit 
 information from site. The first logical step - to make it in the 
administrative part. But the right to work only in the administrative part.
As the right to move to the site?

-- 
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 django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/e493b9ca-b536-40cb-84b7-daa4c0af56b6%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: create unmanaged model to oracle view/synonym

2017-02-16 Thread Sunil Naik
Thanks Collin, it worked for me.

On Monday, January 5, 2015 at 12:56:33 AM UTC+5:30, Collin Anderson wrote:
>
> Hi,
>
> What happens when you try Shai's suggestion?
>
> class MyUnManagedModel(models.Model):
> # ...
> # fields
> # ...
> class Meta:
> managed = False
> db_table = 'view_name'
>
> Collin
>
> On Friday, January 2, 2015 9:05:24 AM UTC-5, Fabio Caritas Barrionuevo da 
> Luz wrote:
>>
>> Hello, Shai and Edgar
>>
>> yes, I've tried using *inspectdb*, however, it only generates models for 
>> database tables, but not for database View[1] and database Synonym[2].
>>
>> The Django documentation is currently not explicit in showing that the 
>> specific database features are supported by Django database backends.
>>
>> *inspectdb *does not support "database schemas"[3][4].
>>
>> Any other ideas how to solve this?
>>
>>
>> [1] 
>> http://docs.oracle.com/cd/B19306_01/server.102/b14200/statements_8004.htm
>> [2] 
>> http://docs.oracle.com/cd/B19306_01/server.102/b14200/statements_8004.htm
>> [3] https://groups.google.com/d/msg/django-users/jsoDvI7DipU/CYOdstKeTYcJ
>>  
>> [4] https://code.djangoproject.com/ticket/22673
>>
>>
>> -- 
>> Fábio C. Barrionuevo da Luz
>> Acadêmico de Sistemas de Informação na Faculdade Católica do Tocantins - 
>> FACTO
>> Palmas - Tocantins - Brasil - América do Sul
>>
>> http://pythonclub.com.br/
>>
>>
>> Em quinta-feira, 1 de janeiro de 2015 16h57min38s UTC-3, Edgar Gabaldi 
>> escreveu:
>>>
>>> Fabio,
>>>
>>> Django ORM support Oracle Database[1].
>>>
>>> If you want connect an existing oracle database, i recomend you see the 
>>> inspectdb management command.
>>>
>>> [1] https://docs.djangoproject.com/en/1.7/ref/databases/#oracle-notes
>>> [2] https://docs.djangoproject.com/en/1.7/howto/legacy-databases/
>>>
>>>
>>> On Thu, Jan 1, 2015 at 2:40 PM, Shai  wrote:
>>>
 Hi Fábio,

 On Wednesday, December 31, 2014 6:05:05 PM UTC+2, Fabio Caritas 
 Barrionuevo da Luz wrote:
>
> Hello, is possible with Django 1.7 create a unmanaged Django model for 
> Oracle database View?
>
>
>
 Yes. In your model's Meta, set managed to False and db_table to the 
 view name:

 class MyUnManagedModel(models.Model):
 # ...
 # fields
 # ...
 class Meta:
 managed = False
 db_table = 'view_name'

 Have you run into difficulties?

 HTH,
 Shai.

 -- 
 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 django-users...@googlegroups.com.
 To post to this group, send email to django...@googlegroups.com.
 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/bf043f16-043a-4f0f-a6bf-2856c405be43%40googlegroups.com
  
 
 .

 For more options, visit https://groups.google.com/d/optout.

>>>
>>>

-- 
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 django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/3d6ac3c4-7740-493f-be05-0882d618a1d6%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: How to integrate a python algorithm in a Django website

2017-02-16 Thread david ekchajzer
Hello, 

first thank you. My question would be: 

How could I use the data from my website database on a python algorithm? 
Should I put my python algorithm on a server?  How good I access these data?
Or is there a way with Django to use the data ?

-- 
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 django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/c9186637-91bc-4bcd-a9df-8630b4bead9c%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: How to integrate a python algorithm in a Django website

2017-02-16 Thread david ekchajzer
Hello, 

first thank you. My question would be: 

How could I use the data from my website database on a python algorithm? 
Should I put my python algorithm on a server?  How good I access these data?
Or is there a way with Django to use the data ?

-- 
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 django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/86433e9c-e8cd-47a5-93c0-c4e49f9f5612%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.