These are chat archives for django/django

16th
Aug 2016
mark
@thenewidealism_twitter
Aug 16 2016 00:32
@malinich you there?
Alexey Rogachev
@arogachev
Aug 16 2016 05:49
@heltucosta What's your specific problem?
@heltucosta http://crontab.guru/
ikhsanputra07
@ikhsanputra07
Aug 16 2016 10:12
Hello guys, i have problem about inline formset. i want assign value in inline formset, i use instance to assign this value like this
blob
but it's not saved on database. how to assign value on inline formset?
mark
@thenewidealism_twitter
Aug 16 2016 12:02
i have a question regarding django rest framework : i get how the post system works using the ajax POST, but how do i load preexisting title and contents to the field for the EDIT?
Igor Malinov
@malinich
Aug 16 2016 12:04
you use angularjs resources?
mark
@thenewidealism_twitter
Aug 16 2016 12:09
ah yes. but for the posting functions, i use mostly ajax
cause i don’t understand much about angular.
Entry.save($scope.entry, function() {
if you populate your model for example after Entry.get it will fill your fields
mark
@thenewidealism_twitter
Aug 16 2016 12:17
ah.
it’s too difficult for me to understand at the moment.
Igor Malinov
@malinich
Aug 16 2016 12:23

Entry.get({ id: $scope.id }, function(data) {
$scope.entry = data
// inside your title
})
// or set youself
// $scope.entry.title = 'something'

<form name="LovelyForm" novalidate ng-controller="formController" ng-submit="submit()" >
<input type="text" name="LovelyText" placeholder="Some Text 1" ng-model=" entry.title" required/>

    <input type="text" name="LovelyText2" placeholder="Some Text 2" ng-model=" entry.field1" required/>

    <input type="text" name="LovelyText3" placeholder="Some Text 3" ng-model="text3.field2" required/>

    <input type="submit" value="Send Text" ng-disabled="LovelyForm.$invalid">

</form>
function formController($scope){
$scope.submit=function(){
Entry.save($scope.entry, function() {})
}
}

mark
@thenewidealism_twitter
Aug 16 2016 12:26
urgg i guess i will have to focus on other problems first
thanks for the help anyways.
there is real problem with the site though. the comment field won’t work.
could you maybe take a look at this and tell me why it isn’t working when you get off the work?
no one seems to know.
Igor Malinov
@malinich
Aug 16 2016 12:30
ok i will try
mark
@thenewidealism_twitter
Aug 16 2016 12:31
thanks.
Arthur Silva
@arxdsilva
Aug 16 2016 14:18
Hey guys! Do you know if in a for loop it is possible to get the item's array index?
Igor Malinov
@malinich
Aug 16 2016 14:19
for idx, item in enumerate([1,2,3])
Arthur Silva
@arxdsilva
Aug 16 2016 14:22
    {% for e, i in array %} ?
Igor Malinov
@malinich
Aug 16 2016 14:23
{{ forloop.counter }} # inside forloop
Variable Description
forloop.counter The current iteration of the loop (1-indexed)
forloop.counter0 The current iteration of the loop (0-indexed)
MinJae Kwon
@mingrammer
Aug 16 2016 14:27
like this
{% for e in array %}
    no.{{ forloop.counter }}
    content : {{ e }}
{% endfor %}
mark
@thenewidealism_twitter
Aug 16 2016 14:28
urg i had to use angular for that
Stephen Ohimor
@ohimors
Aug 16 2016 14:28
Does anyone know how to turn on stack trace for requests that result in a 500 response?
mark
@thenewidealism_twitter
Aug 16 2016 14:29
@malinich you get off from work in an hour?
Igor Malinov
@malinich
Aug 16 2016 14:30
yes but i only my home will after 2.5 hour
mark
@thenewidealism_twitter
Aug 16 2016 14:30
oooh..
Igor Malinov
@malinich
Aug 16 2016 14:30
@cerberusaeon if your use nginx i don't think is possible
logger is not fit to you?
MinJae Kwon
@mingrammer
Aug 16 2016 14:31
@cerberusaeon did you set the DEBUG=False?
Stephen Ohimor
@ohimors
Aug 16 2016 14:32
DEBUG is set to false
Igor Malinov
@malinich
Aug 16 2016 14:32
)
@cerberusaeon @cerberusaeon did you set the DEBUG=False? is right
@cerberusaeon is right
Stephen Ohimor
@ohimors
Aug 16 2016 14:33
also allowed_hosts = [*]
MinJae Kwon
@mingrammer
Aug 16 2016 14:33
if DEBUG is set to False, stack trace is not show .. um
Stephen Ohimor
@ohimors
Aug 16 2016 14:34
oh okay hold on
Arthur Silva
@arxdsilva
Aug 16 2016 14:39
thx!
@malinich
Stephen Ohimor
@ohimors
Aug 16 2016 14:40
@mingrammer just checked code, debug is set to TRUE
Igor Malinov
@malinich
Aug 16 2016 14:40
+1
Stephen Ohimor
@ohimors
Aug 16 2016 14:41
is there a console logging level somewhere?
MinJae Kwon
@mingrammer
Aug 16 2016 14:42
stack trace log is show on browser and your console when DEBUG is set to True
Stephen Ohimor
@ohimors
Aug 16 2016 14:44
The stack trace is not available in the browser. The console I'm referring to is the one on the server. If a server error occurs then the stack trace should be printed to the server log
Igor Malinov
@malinich
Aug 16 2016 14:47

inside file are you use logger same way?
logger = logging.getLogger(name)

try:
5/0
except ZeroDivisionError:
logger.exception(e)

it will save to file if you configure your LOGGING into settings.py

logger = logging.getLogger(name)
try:
    5/0
except ZeroDivisionError: 
    logger.exception(e)
Stephen Ohimor
@ohimors
Aug 16 2016 14:49
@malinich thanks, I'll give that a try
Igor Malinov
@malinich
Aug 16 2016 14:50
and check your logger config
```
'django': {
            'handlers': [
                'console',
                'file_handler',
            ],
            'level': 'INFO',
            'formatter': 'default',
            'propagate': False,
        },
Braintelligence
@Braintelligence
Aug 16 2016 14:56
@poppabear8883 I'm here
Everett (Mike) Wiley
@poppabear8883
Aug 16 2016 19:25
dude that was like ages ago :P