django_bootstrap_calendar and admin backend

177 views
Skip to first unread message

Cronos Cto

unread,
Jul 7, 2016, 3:20:21 PM7/7/16
to Django users

I am doing a project where I gotta explore as much of the Django framework as possible.

One of the things I want to do is to implement the app django_bootstrap_calendar, so far I was able to implement the the calendar to a button that is a linked to the calendars address.

I am having a hard time figuring out how to implement the backend of the calendar, like creating\editing events and such...

I have googled alot, and was not able to find anything that could help in that regard.

If anyone could guide me through this it would be awesome.



Message has been deleted

Cronos Cto

unread,
Jul 12, 2016, 10:49:59 AM7/12/16
to Django users
Ok so I was able to fix one of my problems, consisted in framework not recognizing the database, had to delete it and migrate everything again. Right now I can add events in my backend, but when I check my website the day where I have set the  event lights up, but does not show title, hour or anything... 


calendarioLightUpButNoInfo3.png
calendarioLightUpButNoInfo.png
calendarioLightUpButNoInfo2.png

ludovic coues

unread,
Jul 13, 2016, 6:26:47 AM7/13/16
to django...@googlegroups.com
Code would be more useful to understand what is happening.

Or you can use the django test client [1] to see what the view is
returning as context. The list of event might be empty.

[1] https://docs.djangoproject.com/en/1.9/intro/tutorial05/#the-django-test-client
> --
> 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/09215dec-54a1-48ea-8b47-bb71a40ce453%40googlegroups.com.
>
> For more options, visit https://groups.google.com/d/optout.



--

Cordialement, Coues Ludovic
+336 148 743 42

Cronos Cto

unread,
Jul 13, 2016, 4:33:04 PM7/13/16
to Django users
Hello Ludovic, what part of the code would you like me to post ? 

ludovic coues

unread,
Jul 14, 2016, 5:29:10 AM7/14/16
to django...@googlegroups.com
If you are using
https://github.com/sandlbn/django-bootstrap-calendar/, I assume you
have changed some things. For exemple, the module don't come with an
admin.py file.
All your change would be nice so we can replicate your problem :)

2016-07-13 22:33 GMT+02:00 Cronos Cto <cron...@gmail.com>:
> Hello Ludovic, what part of the code would you like me to post ?
>
> --
> 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/6dfb8f1c-70be-433f-b2fc-e79a3c1507f1%40googlegroups.com.

Cronos Cto

unread,
Jul 14, 2016, 5:54:43 AM7/14/16
to Django users



This are the parts I changed.




\mysite\mysite\settings.py

INSTALLED_APPS = [
'django_bootstrap_calendar',
'blog',
'staff',
    'django.contrib.admin',
    'django.contrib.auth',
    'django.contrib.contenttypes',
    'django.contrib.sessions',
    'django.contrib.messages',
    'django.contrib.staticfiles',
]
-------------------------------------------------------------------------------------
\mysite\mysite\urls.py

from django.conf.urls import url, include
from django.contrib import admin

urlpatterns = [
    url(r'^admin/', admin.site.urls),
url(r'^', include('staff.urls')),
url(r'^blog/', include('blog.urls')),
url(r'^calendar/',include('django_bootstrap_calendar.urls')),
]
-------------------------------------------------------------------------------------

\mysite\django_bootstrap_calendar\admin.py

from django.contrib import admin
from django_bootstrap_calendar.models import CalendarEvent

class CalendarEventAdmin(admin.ModelAdmin):
    list_display = ["title", "url", "css_class", "start", "end"]
    list_filler = ["title"]

admin.site.register(CalendarEvent,CalendarEventAdmin)

-------------------------------------------------------------------------------------
\mysite\staff\templates\staff\header.html

<!DOCTYPE html>
<html lang="en">

<!DOCTYPE html>
<html lang="en">

<head>
<title>Centro de Dia de Messines</title>
<meta charset="utf-8" />
{% load staticfiles %}
<link rel="stylesheet" href="{% static 'staff/css/bootstrap.min.css' %}" type = "text/css"/>
<meta name="viewport" content = "width=device-width, initial-scale=1.0">
<style type="text/css">
html,
body {
 height:100%
}
</style>
</head>

<body class="body" style="background-color:#f6f6f6">
<div class="container-fluid" style="min-height:95%; ">
<div class="row">
 <div class="col-sm-4">
 <br>
 <center>
<img src="{% static 'staff/img/profile.jpg' %}" class="responsive-img" style='max-height:100px;' alt="face">
 </center>
 </div>
 <div class="col-sm-4">
 <br>
 <center>
 <h3>Uma Familia maior</h3>
 </center>
 </div>
</div><hr>

<div class="row">
 <div class="col-sm-3">
 <br>

 <br>
  <!-- Great, til you resize. -->
<!--<div class="well bs-sidebar affix" id="sidebar" style="background-color:#fff">-->
<div class="well bs-sidebar" id="sidebar" style="background-color:#fff">
 <ul class="nav nav-pills nav-stacked">
<li><a href='/'>Ínicio</a></li>
<li><a href='/calendar/'>Calendário</a></li>
<li><a href='/blog/'>Blog</a></li>
<li><a href='/contact/'>Contatos</a></li>
 </ul>
</div> <!--well bs-sidebar affix-->
 </div> <!--col-sm-2-->
 <div class="col-sm-3">
 
<div class='container-fluid'>
<br><br>
  {% block content %}
  {% endblock %}
</div>
 </div>
</div> 
</div>
<footer>
<div class="container-fluid" style='margin-left:15px'>
<p><a href="#" target="blank">Contact</a> | <a href="#" target="blank">LinkedIn</a> | <a href="#" target="blank">Twitter</a> | <a href="#" target="blank">Google+</a></p>
</div>
</footer>
</body>

</html>




This about all the stuff I changed, I realize that some code that I still need to change is not changed like Load templatetags, In your template file, base.html file css section and base.html file javascript section. The problem is I do not understand very well where to do this part of the instalation.

If needed I can send you the files so you can replicate easier.

ludovic coues

unread,
Jul 14, 2016, 8:50:16 AM7/14/16
to django...@googlegroups.com
I haven't managed to reproduce your error. In fact, I managed to make
it working.

What output do you get when you hit
http://localhost:8000/calendar/json/?from=1465324000000&to=1490002400000
? Adjust the hostname and port to your dev server.
> --
> 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/9b930883-674c-4b53-9344-d225a4869a22%40googlegroups.com.

Cronos Cto

unread,
Jul 19, 2016, 3:23:33 PM7/19/16
to Django users
This happened. Sorry for taking so long, had exams to take care of.
calendarjsonTry.png

ludovic coues

unread,
Jul 20, 2016, 7:37:26 AM7/20/16
to django...@googlegroups.com
You might have noticed, the calendar view is a generic template view.
It only display an html page.
All the work is done with js. If everything work fine, it fetch the
list of even for the period with ajax and add the event in the
calendar.

/calendar/json should return the list of event. As you can see, you
get an error. The problem is that the library is python2 only. The
type unicode have been removed in python3 as every str are now
unicode.

I managed to make the library work only with python2.

2016-07-19 21:23 GMT+02:00 Cronos Cto <cron...@gmail.com>:
> This happened. Sorry for taking so long, had exams to take care of.
>
> --
> 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/32bb5e5c-6a72-446b-a8b5-25c3f93badf7%40googlegroups.com.

Cronos Cto

unread,
Jul 20, 2016, 2:40:41 PM7/20/16
to Django users
That explains alot of the issues I am having. Since it is a compatibility issue, I am guessing there is no way to make it work right?

ludovic coues

unread,
Jul 20, 2016, 7:06:26 PM7/20/16
to django...@googlegroups.com
it shouldn't be too hard to port it to python3. The module is mainly
javascript, not python.

Once the app can return json, it should work fine.



2016-07-20 20:40 GMT+02:00 Cronos Cto <cron...@gmail.com>:
> That explains alot of the issues I am having. Since it is a compatibility
> issue, I am guessing there is no way to make it work right?
>
> --
> 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/9fcc888d-d258-4fc9-8fe9-52b1673e761c%40googlegroups.com.

janne.j...@gmail.com

unread,
Nov 1, 2016, 5:24:45 PM11/1/16
to Django users
I am  trying to make reservation calendar for rent cabin web pages, but I am having
problems with adding events to the calendar using admin. I have added admin.py file
to myapp/django_bootstrap_calendar/admin.py with content:


from django.contrib import admin
from django_bootstrap_calendar.models import CalendarEvent

class CalendarEventAdmin(admin.ModelAdmin):
    list_display = ["title", "url", "css_class", "start", "end"]
    list_filler = ["title"]

admin.site.register(CalendarEvent, CalendarEventAdmin)

I have also made migrations.

Still the model is missing from the admin panel and I am out of tricks what to try next.
Does anybody have any hints what I could try next?
Reply all
Reply to author
Forward
0 new messages