コード例 #1
0
def addproperty(request):
    if request.method == 'POST':
        form = PropertyForm(request.POST, request.FILES)
        if form.is_valid():
            current_user = request.user
            data = Property()  # model ile baglantl kur
            data.user_id = current_user.id
            data.category = form.cleaned_data['category']
            data.title = form.cleaned_data['title']
            data.keywords = form.cleaned_data['keywords']
            data.price = form.cleaned_data['price']
            data.floor = form.cleaned_data['floor']
            data.room = form.cleaned_data['room']
            data.rate = form.cleaned_data['rate']
            data.baby_room = form.cleaned_data['square meters']
            data.square_metre = form.cleaned_data['square_metre']
            data.description = form.cleaned_data['description']
            data.image = form.cleaned_data['image']
            data.address = form.cleaned_data['address']
            data.slug = form.cleaned_data['slug']
            data.detail = form.cleaned_data['detail']
            data.status = 'False'
            data.save()  # verirabanlna kagdet
            messages.success(request, 'Your Content Insterted Successfuly')
            return HttpResponseRedirect('/user/addimage/%s' % data.id)
        else:
            messages.success(request,
                             'Property Form Error :' + str(form.errors))
            return HttpResponseRedirect('/user/addproperty')
    else:
        category = Category.objects.all()
        setting = Setting.objects.get(pk=1)
        form = PropertyForm()
        context = {'category': category, 'form': form, 'setting': setting}
        return render(request, 'user_addproperty.html', context)
コード例 #2
0
def addcontent(request):
    if request.method == 'POST':
        form = PropertyForm(request.POST, request.FILES)
        if form.is_valid():
            current_user = request.user
            data = Property()
            data.category= form.cleaned_data['category']
            data.user_id = current_user.id
            data.title = form.cleaned_data['title']
            data.keywords = form.cleaned_data['keywords']
            data.description = form.cleaned_data['description']
            data.price = form.cleaned_data['price']
            data.square_metre = form.cleaned_data['square_metre']
            data.room = form.cleaned_data['room']
            data.floor = form.cleaned_data['floor']
            data.status = 'New'
            data.address = form.cleaned_data['address']
            data.slug = form.cleaned_data['slug']
            data.image = form.cleaned_data['image']
            data.detail = form.cleaned_data['detail']
            data.save()
            messages.success(request, "İçerik başarıyla eklendi")
            return HttpResponseRedirect("/user/contents")
        else:
            messages.warning(request, "İçerik eklenmedi" + str(form.errors))
            return HttpResponseRedirect("/user/contents")


    else:
        form = PropertyForm()
        category = Category.objects.all()
        setting = Setting.objects.get(pk=1)
        context = {
            'category': category,
            'setting': setting,
            'form': form,
        }
        return render(request, 'user_addproperty.html', context)
コード例 #3
0
ファイル: setup_test_prop_data.py プロジェクト: mcgtech/jbook
Property.objects.all().delete()
admin = User.objects.get(pk=1)
prop = Property()
prop.created_by = admin
prop.modified_by = admin
prop.created_on = datetime.now()
prop.modified_on = datetime.now()
prop.name = '11 Hallin Park'
prop.type = Property.COTT
prop.code = 'N598'
prop.start_day = Property.SAT
prop.booking_rule = Property.WILL_CON
prop.promotion = ''
prop.short_description = '<p>Hallin is a beautiful little community in Skye’s north west peninsula of Waternish with unspoilt sea views; north to Ardmore Bay and south to Loch Bay, the inner isles Isay and Mingay and beyond to the western isles.</p>'
prop.description = '<p>Hallin is a beautiful little community in Skye’s north west peninsula of Waternish with unspoilt sea views to the north to Ardmore Bay and south to Loch Bay, the inner isles Isay and Mingay and beyond to the western isles.</p><p>This former Hebridean croft has been upgraded to offer comfortable holiday accommodation, including a sun lounge but without losing any of its warmth and charm, and is the perfect place to enjoy the peace and quiet this area offers. The bubbling burn, the birds on the wind, the countryside with its animals and that wonderful sea breeze. It is also the perfect base to explore the island.</p><p>After a days touring, you can enjoy an evening in front of the open fire or better still, a seat in the sun lounge to enjoy the ever changing sea views. With the outstanding craggy coastline and the many glorious sunsets to be enjoyed, 11 Hallin Park is an excellent self catering holiday cottage providing the perfect base from which to explore the magical Isle of Skye.</p>'
prop.save()

prop = Property()
prop.created_by = admin
prop.modified_by = admin
prop.created_on = datetime.now()
prop.modified_on = datetime.now()
prop.name = 'Cape Cove'
prop.type = Property.LAHS
prop.code = 'A902'
prop.start_day = Property.FRI
prop.booking_rule = Property.WILL_CON
prop.promotion = ''
prop.short_description = '<p>Advertised rent is for up to 8 person.<br />2 additional persons can be accommodated at £50 per person per week and can be booked by phoning our sales team 01738 451 610<br /><br />Cape Cove has recently been re-designed and renovated in a modern beach house style. This exceptionally stylish home not only enjoys a fabulous waterfront location but also a thrilling interior.<br /><br />Reduced rates for parties up to 6 during off and low seasons - please call 01738 451 610 for details.<br />Short breaks by arrangement off and low seasons only - 85% of weekly rate</p>'
prop.description = '<p>Advertised rent is for up to 8 person.<br />2 additional persons can be accommodated at £50 per person per week and can be booked by phoning our sales team 01738 451 610<br /><br />Cape Cove, situated 1 hour from Glasgow, is an architectural award winning modern self catering beach house commanding spectacular views. This unique stylish holiday home not only enjoys a fabulous waterfront location but also a thrilling interior.<br /><br />Stepping into the vast open-plan living space with its seamless glass wall overlooking Loch Long is a jaw-dropping experience. Contemporary yet elegant, this is a wonderfully comfortable room to relax in and absorb the breathtaking sea and mountain views or enjoy watching the storms and weather move across the sea. The well designed kitchen is fully equipped and will delight the most enthusiastic of cooks and the large dining table creates a wonderful gathering place. The oak floors and white painted walls make the bedrooms calm and relaxing. Stairs lead down to a large, bright and airy double bedroom where doors open onto a terrace with steps down to the shoreline. Sink into the comfortable leather sofa and enjoy a good book or perhaps a favourite film. Set aside from the main house, "The Look Out" provides extra accommodation and the same spectacular views.<br /><br />The outside is just as comfortable, the teak decked terrace with its huge table, fireplace and barbecue is a real highlight as is the cedar hot tub. Among the multitude of features and user-friendly technology, the house has been super insulated and enjoys the comfort of heated sandstone and slate floors, atmospheric lighting, a wood burning stove and solar powered (generating more energy than it consumes).<br /><br />Being set on the shoreline, this unforgettable house also has the luxury of its own private, sheltered pebble beach and jetty. Charter a sailing boat and board it from your house, canoe or Kayak to explore the wonders of this beautiful sea loch, wander down to the local pub or fish off the pier. If you fancy a run the shore road is perfect or mountain bike the peninsula for a challenge. For a slower pace golf in Loch Lomond or simply sit and relax on the surrounding rocks and marvel at the many birds, seals and porpoise that thrive here. A marvellous family holiday destination; be aware the sea is not fenced off if there are toddlers or young children in the party they will need to be supervised.<br /><br />The house has its own mooring and boat charter can be arranged locally.<br /><br />Reduced rates for parties up to 6 during off and low seasons - please call 01738 451 610 for details.<br />Short breaks by arrangement off and low seasons only - 85% of weekly rate</p>'