Closed Astate closed 9 years ago
I use build in views
i have create apps.py with
from django.apps import AppConfig
from .models import Logement
import watson
class YourAppConfig(AppConfig):
name = "loyer"
def ready(self):
Logement = self.get_model("Logement")
watson.register(Logement)
this is my model
class Logement(models.Model):
titre = models.CharField(blank=True, max_length=100)
grandeur = models.CharField(blank=True, max_length=30, choices=GRANDEUR)
chauffe = models.BooleanField(default=False)
eclaire = models.BooleanField(default=False)
stationnement = models.CharField(blank=True, max_length=100, choices=STATIONNEMENT)
pub_date = models.DateTimeField('date publication',default=datetime.now, blank=True)
geom = PointField()
manage.py buildwatson Deleted 0 stale search entry(s) in 'admin' search engine. Deleted 0 stale search entry(s) in 'default' search engine. Refreshed 0 search entry(s) in 'default' search engine.
You need to also register your AppConfig with Django.
https://docs.djangoproject.com/en/1.8/ref/applications/ On Wed, 7 Oct 2015 at 01:02, Astate notifications@github.com wrote:
I use build in views
i have create apps.py with
from django.apps import AppConfigfrom .models import Logementimport watson class YourAppConfig(AppConfig): name = "loyer" def ready(self): Logement = self.get_model("Logement") watson.register(Logement)
this is my model
class Logement(models.Model): titre = models.CharField(blank=True, max_length=100) grandeur = models.CharField(blank=True, max_length=30, choices=GRANDEUR) chauffe = models.BooleanField(default=False) eclaire = models.BooleanField(default=False) stationnement = models.CharField(blank=True, max_length=100, choices=STATIONNEMENT) pub_date = models.DateTimeField('date publication',default=datetime.now, blank=True) geom = PointField()
manage.py buildwatson Deleted 0 stale search entry(s) in 'admin' search engine. Deleted 0 stale search entry(s) in 'default' search engine. Refreshed 0 search entry(s) in 'default' search engine.
— Reply to this email directly or view it on GitHub https://github.com/etianen/django-watson/issues/130#issuecomment-146038765 .
Its not clear for me
If i understand i need to do that:
loyer/init.py
default_app_config = 'loyer.apps.YourAppConfig'
Yes, that's what you need to do.
On Wed, 7 Oct 2015 at 15:37 Astate notifications@github.com wrote:
Its not clear for me
If i understand i need to do that:
loyer/init.py
default_app_config = 'loyer.apps.YourAppConfig'
— Reply to this email directly or view it on GitHub https://github.com/etianen/django-watson/issues/130#issuecomment-146213411 .
thanks its work now.
I am having a similar problem. I followed the Wiki. After the configuration the searches were not getting any result, so I tried to add the class to init.py as you did default_app_config = 'loyer.apps.YourAppConfig'
and I started having this problem:
AppRegistryNotReady("Apps aren't loaded yet.") django.core.exceptions.AppRegistryNotReady: Apps aren't loaded yet.
Try the master branch. See if it fixes it for you. On Sat, 20 Feb 2016 at 14:31, hellvix notifications@github.com wrote:
I am having a similar problem. I followed the Wiki. After the configuration the searches were not getting any result, so I tried to add the class to init.py as you did default_app_config = 'loyer.apps.YourAppConfig' and I started having this problem:
AppRegistryNotReady("Apps aren't loaded yet.") django.core.exceptions.AppRegistryNotReady: Apps aren't loaded yet.
— Reply to this email directly or view it on GitHub https://github.com/etianen/django-watson/issues/130#issuecomment-186617564 .
I had to move import inside the function ready() in order to make it work.
I tried the master branch and it did not work. I still go the same problem.
Furthermore, maybe it would be nice to include the init.py thing in the documentation. I don't think it is there.
search_entry.meta should be a dictionary of string keys mapped to string values. So if you had an image field, you can access it in your template as search_entry.meta.field_name
However, it can often be simpler to just access search_entry.object, which will be an actual instance of your model. You can then use any model fields, or methods, you wish.
On Sun, 21 Feb 2016 at 15:26 hellvix notifications@github.com wrote:
Master worked. Thanks.
Another thing: metadata seems fuzzy for some particular kinds of object. I have a related table that stores images for a post and a post can have several images. If I use metadata to access all of this information, I get back a huge string with the images' address. Extracting only one image, for example can be a bit complicated if it is inside of a template. Any suggestions? Also, dates are stored in strings? I have non-naive objects stored. I have to cast them? Is there any api to work with dates on watson?
— Reply to this email directly or view it on GitHub https://github.com/etianen/django-watson/issues/130#issuecomment-186843318 .
Sorry for my ignorance. I read this part in the documentation and started using the results as the object itself.
2016-02-21 18:01 GMT-03:00 Dave Hall notifications@github.com:
search_entry.meta should be a dictionary of string keys mapped to string values. So if you had an image field, you can access it in your template as search_entry.meta.field_name
However, it can often be simpler to just access search_entry.object, which will be an actual instance of your model. You can then use any model fields, or methods, you wish.
On Sun, 21 Feb 2016 at 15:26 hellvix notifications@github.com wrote:
Master worked. Thanks.
Another thing: metadata seems fuzzy for some particular kinds of object. I have a related table that stores images for a post and a post can have several images. If I use metadata to access all of this information, I get back a huge string with the images' address. Extracting only one image, for example can be a bit complicated if it is inside of a template. Any suggestions? Also, dates are stored in strings? I have non-naive objects stored. I have to cast them? Is there any api to work with dates on watson?
— Reply to this email directly or view it on GitHub < https://github.com/etianen/django-watson/issues/130#issuecomment-186843318
.
— Reply to this email directly or view it on GitHub https://github.com/etianen/django-watson/issues/130#issuecomment-186915216 .
No worries! Feel free to tweak the wiki if you think anything needs clarifying. :) On Sun, 21 Feb 2016 at 21:04, hellvix notifications@github.com wrote:
Sorry for my ignorance. I read this part in the documentation and started using the results as the object itself.
2016-02-21 18:01 GMT-03:00 Dave Hall notifications@github.com:
search_entry.meta should be a dictionary of string keys mapped to string values. So if you had an image field, you can access it in your template as search_entry.meta.field_name
However, it can often be simpler to just access search_entry.object, which will be an actual instance of your model. You can then use any model fields, or methods, you wish.
On Sun, 21 Feb 2016 at 15:26 hellvix notifications@github.com wrote:
Master worked. Thanks.
Another thing: metadata seems fuzzy for some particular kinds of object. I have a related table that stores images for a post and a post can have several images. If I use metadata to access all of this information, I get back a huge string with the images' address. Extracting only one image, for example can be a bit complicated if it is inside of a template. Any suggestions? Also, dates are stored in strings? I have non-naive objects stored. I have to cast them? Is there any api to work with dates on watson?
— Reply to this email directly or view it on GitHub <
https://github.com/etianen/django-watson/issues/130#issuecomment-186843318
.
— Reply to this email directly or view it on GitHub < https://github.com/etianen/django-watson/issues/130#issuecomment-186915216
.
— Reply to this email directly or view it on GitHub https://github.com/etianen/django-watson/issues/130#issuecomment-186916437 .
Oh. I that's true. I'll update it :)
Den mandag den 22. februar 2016 skrev Dave Hall notifications@github.com:
No worries! Feel free to tweak the wiki if you think anything needs clarifying. :) On Sun, 21 Feb 2016 at 21:04, hellvix <notifications@github.com javascript:_e(%7B%7D,'cvml','notifications@github.com');> wrote:
Sorry for my ignorance. I read this part in the documentation and started using the results as the object itself.
2016-02-21 18:01 GMT-03:00 Dave Hall <notifications@github.com javascript:_e(%7B%7D,'cvml','notifications@github.com');>:
search_entry.meta should be a dictionary of string keys mapped to string values. So if you had an image field, you can access it in your template as search_entry.meta.field_name
However, it can often be simpler to just access search_entry.object, which will be an actual instance of your model. You can then use any model fields, or methods, you wish.
On Sun, 21 Feb 2016 at 15:26 hellvix <notifications@github.com javascript:_e(%7B%7D,'cvml','notifications@github.com');> wrote:
Master worked. Thanks.
Another thing: metadata seems fuzzy for some particular kinds of object. I have a related table that stores images for a post and a post can have several images. If I use metadata to access all of this information, I get back a huge string with the images' address. Extracting only one image, for example can be a bit complicated if it is inside of a template. Any suggestions? Also, dates are stored in strings? I have non-naive objects stored. I have to cast them? Is there any api to work with dates on watson?
— Reply to this email directly or view it on GitHub <
https://github.com/etianen/django-watson/issues/130#issuecomment-186843318
.
— Reply to this email directly or view it on GitHub <
https://github.com/etianen/django-watson/issues/130#issuecomment-186915216
.
— Reply to this email directly or view it on GitHub < https://github.com/etianen/django-watson/issues/130#issuecomment-186916437
.
— Reply to this email directly or view it on GitHub https://github.com/etianen/django-watson/issues/130#issuecomment-187153073 .
I dont understand where i need to add this thanks to help me