- 🔭 I’m currently working at geoimpact AG
khashashin / blemmy Goto Github PK
View Code? Open in Web Editor NEWThis project forked from datalets/blemmy
License: Other
This project forked from datalets/blemmy
License: Other
Im trying to create restaurant menu table for 2 years. And to create a Database i created model class like:
cultina model class Week
YEARS = (
(2017, 2017),
# (2018, 2018),
)
WEEKS = (
(1,1),(2,2),(3,3),(4,4),(5,5),(6,6),
(7,7),(8,8),(9,9),(10,10),(11,11),(12,12),
(13,13),(14,14),(15,15),(16,16),(17,17),(18,18),
(19,19),(20,20),(21,21),(22,22),(23,23),(24,24),
(25,25),(26,26),(27,27),(28,28),(29,29),(30,30),
(31,31),(32,32),(33,33),(34,34),(35,35),(36,36),
(37,37),(38,38),(39,39),(40,40),(41,41),(42,42),
(43,43),(44,44),(45,45),(46,46),(47,47),(48,48),
(49,49),(50,50),(51,51),(52,52),(53,53),
)
DAYS = (
('Montag',1),
('Dienstag',2),
('Mittwoch',3),
('Donnerstag',4),
('Freitag',5),
)
class Week(models.Model):
country = CountryField(
verbose_name='Land', blank=True, null=True, blank_label='Wochenspezialität ist aus ...')
year = models.IntegerField(verbose_name='Jahr', choices=YEARS,
null=True)
week = models.SmallIntegerField(verbose_name='Woche' ,choices=WEEKS,
and my endpoints.py have:
from wagtail.api.v2.endpoints import BaseAPIEndpoint
from .models import Week, Ingredient, Menu
class WeekAPIEndpoint(BaseAPIEndpoint):
model = Week
def register_endpoints(api_router):
api_router.register_endpoint('week', WeekAPIEndpoint)
And if I follow the link http://saad1.khashashin.com/api/v2/week i get this:
Can I somehow add data that will be equal "year" and "week" to this endpoint http://saad1.khashashin.com/api/v2/week like here:
{
"meta": {
"total_count": 2
},
"items": [
{
"id": 1,
"year": 2017,
"week": 22,
"meta": {
"type": "cultinadb.Week",
"detail_url": "http://saad1.khashashin.com/api/v2/week/1/"
}
},
{
"id": 2,
"year": 2017,
"week": 21,
"meta": {
"type": "cultinadb.Week",
"detail_url": "http://saad1.khashashin.com/api/v2/week/2/"
}
}
]
}
from here http://saad1.khashashin.com/api/v2/week/1:
Its hard to explane for me. I just need them to be available before I click on the link http://saad1.khashashin.com/api/v2/week/1.
I have a class with huge amount of data and another class which should take the title value from this class.
How can I add a search function to ForeignKey as you can see in following Image. Or does Django have a way to solve this problem? Thanks!
I created a similar theme on stackoverflow
class Menue(models.Model):
title = models.CharField(max_length=255)
panels = [
FieldPanel('title', classname="col12"),
]
def __str__(self):
return self.title
class Wochen(models.Model):
menu_1 = models.ForeignKey(Menue,
null=True, blank=True, on_delete=models.PROTECT,
related_name="menu_1+")
panels = [
FieldPanel('menu_1', classname="col12"),
]
def __str__(self):
return self.menu_1
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.