These are chat archives for django/django

12th
Jul 2017
Felipe Campelo
@fccampelo
Jul 12 2017 06:05
hey
i have a Exception
this is : 'str' object has no attribute 'values
someone can help me ?
John
@flyboy1565
Jul 12 2017 07:10
@fccampelo can you provide the code causing the problem?
Gourav Chawla
@Gouravchawla
Jul 12 2017 10:05
Does anyone here know why unique_together would not work? Any way to test it from the shell?
Kanhaiya Lal
@Dragonwarrior47
Jul 12 2017 10:12
@annshress Hi I solved the problem, I used your idea but Cast was not available in django so I did something like this .annotate(
year=YearTransform('violation_time'),
month=MonthTransform('violation_time'),
day=DayTransform('violation_time'),
hour=HourTransform('violation_time')
)
.annotate(temp_interval=Func(F('hour') / interval_in_hours, function='FLOOR'))
.annotate(interval=ExpressionWrapper(F('temp_interval') * interval_in_hours, output_field=IntegerField()))
.values("year", "month", "day", "interval", "zone", "violation_type", "site__site")
@annshress Thanks for helping
Anish Shrestha
@annshress
Jul 12 2017 14:41
@Dragonwarrior47 Awesome :clap:
Costantin
@Cosbgn
Jul 12 2017 16:24
Hello
I'm trying to load some JS dynamically depending on my settings
my view ends with:
    return render(request, 'ga_app/dashboard.html', {'paid':False,
                                                                'webpack_bundle':settings.WEBPACK_SRC} )
settings are: WEBPACK_SRC = "//localhost:8080/dist/build.js"
and in my template I have:
<script src='{{ webpack_bundle }}'></script>
yet I get: <script src(unknown)></script> What I'm missing?
Costantin
@Cosbgn
Jul 12 2017 16:34
I was rendering something wrong, a return HttpReditect('url') fixed it!