Add Django admin integration
MarkusH opened this issue · comments
What i am doing for this atm:
class AppointmentsAdmin(admin.ModelAdmin):
...
# we need those for OSMField to work
class Media:
css = {
'all': ('css/appointments.css',),
}
js = (
'js/jquery-2.1.1.min.js',
)
The inluded CSS file contains a fix to have the map push down the lat/lon fields below when it appears :
.field-location > div {
position: relative;
padding-bottom: 10px;
min-height: 25px;
}
.field-location .osmfield-map {
position: relative;
left: 0px;
top: 40px;
width: 500px;
margin-bottom: 30px;
}
.field-location input {
position: absolute;
left: 105px;
top: 0px;
}
which i sussed out with @netAction a few weeks ago.
Do you want to open a pull request for this issue? The CSS code won't work though in a generic case. field-location
might also be named field-poi
or something.
Maybe you want to have a look at django-geoposition which has this feature already, but for Google Maps.
With django-grappelli
field class is just .location
.
I also changed js
to
js = (
'https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js',
)
Update: fixed.
It stopped working after upgrade to 0.3.0
and I can't understand why.
@int-ua: Can you give me more information? Like copy/paste the files you use on your admin page, the HTML from your admin page, and anything else that might be relevant? I can't really help you without any additional information.
Sorry, it was completely my fault, somehow I've defined widgets
not in a Meta
subclass of ModelForm
but on itsefl and it had no effect. It's completely functional after fixing this error.
This seems to be working just fine for. I'm closing this unless somebody has a more specific issue.